]> source.dussan.org Git - sonarqube.git/commitdiff
Rename ComponentDto#getKey to ComponentDto#getDbKey
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Tue, 1 Aug 2017 12:39:41 +0000 (14:39 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Tue, 1 Aug 2017 13:33:41 +0000 (15:33 +0200)
Preparing component key that will contains branch key

170 files changed:
server/sonar-ce/src/test/java/org/sonar/ce/queue/InternalCeQueueImplTest.java
server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDto.java
server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueDto.java
server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoWithDuplicatedKeysTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDtoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentKeyUpdaterDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentTesting.java
server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueDaoTest.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-db-dao/src/test/java/org/sonar/db/property/PropertiesDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QualityProfileDaoTest.java
server/sonar-server/src/main/java/org/sonar/ce/queue/CeQueueImpl.java
server/sonar-server/src/main/java/org/sonar/server/batch/IssuesAction.java
server/sonar-server/src/main/java/org/sonar/server/batch/ProjectDataLoader.java
server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java
server/sonar-server/src/main/java/org/sonar/server/component/ComponentFinder.java
server/sonar-server/src/main/java/org/sonar/server/component/ComponentUpdater.java
server/sonar-server/src/main/java/org/sonar/server/component/index/ComponentIndexer.java
server/sonar-server/src/main/java/org/sonar/server/component/ws/AppAction.java
server/sonar-server/src/main/java/org/sonar/server/component/ws/ComponentDtoToWsComponent.java
server/sonar-server/src/main/java/org/sonar/server/component/ws/SearchAction.java
server/sonar-server/src/main/java/org/sonar/server/component/ws/SearchProjectsAction.java
server/sonar-server/src/main/java/org/sonar/server/component/ws/SuggestionsAction.java
server/sonar-server/src/main/java/org/sonar/server/component/ws/TreeAction.java
server/sonar-server/src/main/java/org/sonar/server/computation/queue/ReportSubmitter.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/component/UuidFactory.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/filemove/FileMoveDetectionStep.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/PersistComponentsStep.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/ValidateProjectStep.java
server/sonar-server/src/main/java/org/sonar/server/duplication/ws/ShowResponseBuilder.java
server/sonar-server/src/main/java/org/sonar/server/favorite/FavoriteUpdater.java
server/sonar-server/src/main/java/org/sonar/server/favorite/ws/SearchAction.java
server/sonar-server/src/main/java/org/sonar/server/issue/IssueUpdater.java
server/sonar-server/src/main/java/org/sonar/server/issue/notification/IssueChangeNotification.java
server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchResponseFormat.java
server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/CreateAction.java
server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/CustomMeasureJsonWriter.java
server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentDtoToWsComponent.java
server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeAction.java
server/sonar-server/src/main/java/org/sonar/server/measure/ws/SearchAction.java
server/sonar-server/src/main/java/org/sonar/server/notification/ws/ListAction.java
server/sonar-server/src/main/java/org/sonar/server/permission/PermissionTemplateService.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/SearchProjectPermissionsAction.java
server/sonar-server/src/main/java/org/sonar/server/project/ws/CreateAction.java
server/sonar-server/src/main/java/org/sonar/server/project/ws/GhostsAction.java
server/sonar-server/src/main/java/org/sonar/server/project/ws/IndexAction.java
server/sonar-server/src/main/java/org/sonar/server/project/ws/ProvisionedAction.java
server/sonar-server/src/main/java/org/sonar/server/project/ws/SearchAction.java
server/sonar-server/src/main/java/org/sonar/server/project/ws/SearchMyProjectsAction.java
server/sonar-server/src/main/java/org/sonar/server/projecttag/ws/SetAction.java
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/SearchAction.java
server/sonar-server/src/main/java/org/sonar/server/source/ws/LinesAction.java
server/sonar-server/src/main/java/org/sonar/server/startup/DisplayLogOnDeprecatedProjects.java
server/sonar-server/src/main/java/org/sonar/server/test/ws/CoveredFilesAction.java
server/sonar-server/src/main/java/org/sonar/server/test/ws/ListAction.java
server/sonar-server/src/main/java/org/sonar/server/ui/ws/ComponentAction.java
server/sonar-server/src/main/java/org/sonar/server/webhook/ws/WebhookWsSupport.java
server/sonar-server/src/test/java/org/sonar/ce/queue/CeQueueImplTest.java
server/sonar-server/src/test/java/org/sonar/server/batch/IssuesActionTest.java
server/sonar-server/src/test/java/org/sonar/server/batch/ProjectDataLoaderMediumTest.java
server/sonar-server/src/test/java/org/sonar/server/batch/ProjectDataLoaderTest.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
server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskFormatterTest.java
server/sonar-server/src/test/java/org/sonar/server/component/ComponentCleanerServiceTest.java
server/sonar-server/src/test/java/org/sonar/server/component/ComponentFinderTest.java
server/sonar-server/src/test/java/org/sonar/server/component/ComponentServiceTest.java
server/sonar-server/src/test/java/org/sonar/server/component/ComponentServiceUpdateKeyTest.java
server/sonar-server/src/test/java/org/sonar/server/component/ComponentUpdaterTest.java
server/sonar-server/src/test/java/org/sonar/server/component/index/ComponentIndexFeatureFavoriteTest.java
server/sonar-server/src/test/java/org/sonar/server/component/index/ComponentIndexFeatureRecentlyBrowsedTest.java
server/sonar-server/src/test/java/org/sonar/server/component/index/ComponentIndexScoreTest.java
server/sonar-server/src/test/java/org/sonar/server/component/index/ComponentIndexTest.java
server/sonar-server/src/test/java/org/sonar/server/component/ws/AppActionTest.java
server/sonar-server/src/test/java/org/sonar/server/component/ws/SearchActionTest.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/ShowActionTest.java
server/sonar-server/src/test/java/org/sonar/server/component/ws/SuggestionsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/component/ws/TreeActionTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/queue/ReportSubmitterTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/component/ConfigurationRepositoryTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/filemove/FileMoveDetectionStepTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/issue/IntegrateIssuesVisitorTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/BuildComponentTreeStepTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/LoadCrossProjectDuplicationsRepositoryStepTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/PersistMeasuresStepTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ReportPersistAnalysisStepTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ReportPersistComponentsStepTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ValidateProjectStepTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ViewsPersistAnalysisStepTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ViewsPersistComponentsStepTest.java
server/sonar-server/src/test/java/org/sonar/server/duplication/ws/DuplicationsParserTest.java
server/sonar-server/src/test/java/org/sonar/server/duplication/ws/ShowActionTest.java
server/sonar-server/src/test/java/org/sonar/server/duplication/ws/ShowResponseBuilderTest.java
server/sonar-server/src/test/java/org/sonar/server/favorite/FavoriteUpdaterTest.java
server/sonar-server/src/test/java/org/sonar/server/favorite/ws/AddActionTest.java
server/sonar-server/src/test/java/org/sonar/server/favorite/ws/RemoveActionTest.java
server/sonar-server/src/test/java/org/sonar/server/favorite/ws/SearchActionTest.java
server/sonar-server/src/test/java/org/sonar/server/issue/ActionFinderTest.java
server/sonar-server/src/test/java/org/sonar/server/issue/IssueQueryFactoryTest.java
server/sonar-server/src/test/java/org/sonar/server/issue/IssueUpdaterTest.java
server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexTest.java
server/sonar-server/src/test/java/org/sonar/server/issue/notification/IssueChangeNotificationTest.java
server/sonar-server/src/test/java/org/sonar/server/issue/ws/BulkChangeActionTest.java
server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionComponentsMediumTest.java
server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionComponentsTest.java
server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionMediumTest.java
server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/CreateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/MetricsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/SearchActionTest.java
server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/UpdateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/measure/index/ProjectMeasuresIndexTest.java
server/sonar-server/src/test/java/org/sonar/server/measure/index/ProjectMeasuresIndexTextSearchTest.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/measure/ws/SearchActionTest.java
server/sonar-server/src/test/java/org/sonar/server/measure/ws/SearchHistoryActionTest.java
server/sonar-server/src/test/java/org/sonar/server/notification/ws/AddActionTest.java
server/sonar-server/src/test/java/org/sonar/server/notification/ws/ListActionTest.java
server/sonar-server/src/test/java/org/sonar/server/notification/ws/RemoveActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddGroupActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/AddUserActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/GroupsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveGroupActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/RemoveUserActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/SearchProjectPermissionsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/UsersActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/ApplyTemplateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/permission/ws/template/BulkApplyTemplateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/project/ws/BulkDeleteActionTest.java
server/sonar-server/src/test/java/org/sonar/server/project/ws/BulkUpdateKeyActionTest.java
server/sonar-server/src/test/java/org/sonar/server/project/ws/CreateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/project/ws/DeleteActionTest.java
server/sonar-server/src/test/java/org/sonar/server/project/ws/GhostsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/project/ws/IndexActionTest.java
server/sonar-server/src/test/java/org/sonar/server/project/ws/ProvisionedActionTest.java
server/sonar-server/src/test/java/org/sonar/server/project/ws/SearchActionTest.java
server/sonar-server/src/test/java/org/sonar/server/project/ws/SearchMyProjectsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/project/ws/UpdateKeyActionTest.java
server/sonar-server/src/test/java/org/sonar/server/project/ws/UpdateVisibilityActionTest.java
server/sonar-server/src/test/java/org/sonar/server/projectanalysis/ws/SearchActionTest.java
server/sonar-server/src/test/java/org/sonar/server/projectlink/ws/CreateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/projectlink/ws/DeleteActionTest.java
server/sonar-server/src/test/java/org/sonar/server/projectlink/ws/SearchActionTest.java
server/sonar-server/src/test/java/org/sonar/server/projecttag/ws/SearchActionTest.java
server/sonar-server/src/test/java/org/sonar/server/projecttag/ws/SetActionTest.java
server/sonar-server/src/test/java/org/sonar/server/property/ws/IndexActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualitygate/QualityGatesTest.java
server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/DeselectActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/GetByProjectActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/ProjectStatusActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/SelectActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/SearchActionTest.java
server/sonar-server/src/test/java/org/sonar/server/setting/ws/ListDefinitionsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/setting/ws/ResetActionTest.java
server/sonar-server/src/test/java/org/sonar/server/setting/ws/SetActionTest.java
server/sonar-server/src/test/java/org/sonar/server/setting/ws/ValuesActionTest.java
server/sonar-server/src/test/java/org/sonar/server/source/ws/IndexActionTest.java
server/sonar-server/src/test/java/org/sonar/server/source/ws/LinesActionTest.java
server/sonar-server/src/test/java/org/sonar/server/source/ws/ScmActionTest.java
server/sonar-server/src/test/java/org/sonar/server/startup/DisplayLogOnDeprecatedProjectsTest.java
server/sonar-server/src/test/java/org/sonar/server/test/ws/CoveredFilesActionTest.java
server/sonar-server/src/test/java/org/sonar/server/test/ws/ListActionTest.java
server/sonar-server/src/test/java/org/sonar/server/ui/ws/ComponentActionTest.java
server/sonar-server/src/test/java/org/sonar/server/user/ServerUserSessionTest.java
server/sonar-server/src/test/java/org/sonar/server/webhook/ws/WebhookDeliveriesActionTest.java
server/sonar-server/src/test/java/org/sonar/server/webhook/ws/WebhookDeliveryActionTest.java

index dfc955308bc4cca9de4213ccdcfc858a0a437b49..84d7e2097bc0175cf47b1bd925bfcd47104244d6 100644 (file)
@@ -696,7 +696,7 @@ public class InternalCeQueueImplTest {
       assertThat(task.getComponentKey()).isNull();
       assertThat(task.getComponentName()).isNull();
     } else {
-      assertThat(task.getComponentKey()).isEqualTo(componentDto.key());
+      assertThat(task.getComponentKey()).isEqualTo(componentDto.getDbKey());
       assertThat(task.getComponentName()).isEqualTo(componentDto.name());
     }
     assertThat(task.getSubmitterLogin()).isEqualTo(taskSubmit.getSubmitterLogin());
@@ -713,7 +713,7 @@ public class InternalCeQueueImplTest {
   }
 
   private ComponentDto newComponentDto(String uuid) {
-    return ComponentTesting.newPublicProjectDto(dbTester.getDefaultOrganization(), uuid).setName("name_" + uuid).setKey("key_" + uuid);
+    return ComponentTesting.newPublicProjectDto(dbTester.getDefaultOrganization(), uuid).setName("name_" + uuid).setDbKey("key_" + uuid);
   }
 
   private CeTask submit(String reportType, String componentUuid) {
index 48fb43c7e5a9e5cd3b83f3569bbc9c1caf05024c..42338f71817ec36287932c26a2580a84312598be 100644 (file)
@@ -173,10 +173,33 @@ public class ComponentDto {
     return UUID_PATH_SPLITTER.splitToList(uuidPath);
   }
 
-  public String key() {
+  /**
+   * Used my MyBatis mapper
+   */
+  private String getKee(){
+    return kee;
+  }
+
+  /**
+   * Used my MyBatis mapper
+   */
+  private void setKee(String kee){
+    this.kee = kee;
+  }
+
+  public String getDbKey() {
     return kee;
   }
 
+  public ComponentDto setDbKey(String key) {
+    this.kee = checkComponentKey(key);
+    return this;
+  }
+
+  public String getKey() {
+    return getDbKey();
+  }
+
   public String scope() {
     return scope;
   }
@@ -341,15 +364,6 @@ public class ComponentDto {
     return this;
   }
 
-  public String getKey() {
-    return key();
-  }
-
-  public ComponentDto setKey(String key) {
-    this.kee = checkComponentKey(key);
-    return this;
-  }
-
   public boolean isRootProject() {
     return moduleUuid == null && Scopes.PROJECT.equals(scope);
   }
index 497fd2429011cc74701595591b3502fdc72963e9..2220fa710149caec9b2ab5f3b54009d1fd93e41e 100644 (file)
@@ -211,7 +211,7 @@ public final class IssueDto implements Serializable {
   }
 
   public IssueDto setComponent(ComponentDto component) {
-    this.componentKey = component.getKey();
+    this.componentKey = component.getDbKey();
     this.componentUuid = component.uuid();
     this.moduleUuid = component.moduleUuid();
     this.moduleUuidPath = component.moduleUuidPath();
@@ -220,7 +220,7 @@ public final class IssueDto implements Serializable {
   }
 
   public IssueDto setProject(ComponentDto project) {
-    this.projectKey = project.getKey();
+    this.projectKey = project.getDbKey();
     this.projectUuid = project.uuid();
     return this;
   }
index 21889265e7d9a31a54c9d169d27986ef5ff0ae18..1bcb0f0cba2084caa79665392acd701dffefcbaf 100644 (file)
@@ -95,7 +95,7 @@ public class ComponentDaoTest {
     assertThat(result.moduleUuidPath()).isEqualTo("module_uuid_path_of_U1");
     assertThat(result.getRootUuid()).isEqualTo("U1");
     assertThat(result.projectUuid()).isEqualTo("U1");
-    assertThat(result.key()).isEqualTo("org.struts:struts");
+    assertThat(result.getDbKey()).isEqualTo("org.struts:struts");
     assertThat(result.path()).isEqualTo("path_of_U1");
     assertThat(result.name()).isEqualTo("Struts");
     assertThat(result.longName()).isEqualTo("Apache Struts");
@@ -120,7 +120,7 @@ public class ComponentDaoTest {
     assertThat(result.moduleUuidPath()).isEqualTo("module_uuid_path_of_U7");
     assertThat(result.getRootUuid()).isEqualTo("root_uuid_of_U7");
     assertThat(result.projectUuid()).isEqualTo("project_uuid_of_U7");
-    assertThat(result.key()).isEqualTo("DEV:anakin@skywalker.name:org.struts:struts");
+    assertThat(result.getDbKey()).isEqualTo("DEV:anakin@skywalker.name:org.struts:struts");
     assertThat(result.path()).isNull();
     assertThat(result.name()).isEqualTo("Apache Struts");
     assertThat(result.longName()).isEqualTo("Apache Struts");
@@ -169,7 +169,7 @@ public class ComponentDaoTest {
     ComponentDto result = optional.get();
     assertThat(result.getOrganizationUuid()).isEqualTo("org1");
     assertThat(result.uuid()).isEqualTo("U4");
-    assertThat(result.key()).isEqualTo("org.struts:struts-core:src/org/struts/RequestContext.java");
+    assertThat(result.getDbKey()).isEqualTo("org.struts:struts-core:src/org/struts/RequestContext.java");
     assertThat(result.path()).isEqualTo("path_of_U4");
     assertThat(result.name()).isEqualTo("RequestContext.java");
     assertThat(result.longName()).isEqualTo("org.struts.RequestContext");
@@ -203,7 +203,7 @@ public class ComponentDaoTest {
     db.prepareDbUnit(getClass(), "shared.xml");
 
     ComponentDto result = underTest.selectOrFailByKey(dbSession, "org.struts:struts");
-    assertThat(result.key()).isEqualTo("org.struts:struts");
+    assertThat(result.getDbKey()).isEqualTo("org.struts:struts");
     assertThat(result.uuid()).isEqualTo("U1");
     assertThat(result.getUuidPath()).isEqualTo("uuid_path_of_U1");
     assertThat(result.deprecatedKey()).isEqualTo("org.struts:struts");
@@ -226,7 +226,7 @@ public class ComponentDaoTest {
 
     ComponentDto result = results.get(0);
     assertThat(result).isNotNull();
-    assertThat(result.key()).isEqualTo("org.struts:struts-core:src/org/struts/RequestContext.java");
+    assertThat(result.getDbKey()).isEqualTo("org.struts:struts-core:src/org/struts/RequestContext.java");
     assertThat(result.path()).isEqualTo("path_of_U4");
     assertThat(result.name()).isEqualTo("RequestContext.java");
     assertThat(result.longName()).isEqualTo("org.struts.RequestContext");
@@ -247,7 +247,7 @@ public class ComponentDaoTest {
 
     ComponentDto result = results.get(0);
     assertThat(result).isNotNull();
-    assertThat(result.key()).isEqualTo("org.struts:struts-core:src/org/struts/RequestContext.java");
+    assertThat(result.getDbKey()).isEqualTo("org.struts:struts-core:src/org/struts/RequestContext.java");
     assertThat(result.path()).isEqualTo("path_of_U4");
     assertThat(result.name()).isEqualTo("RequestContext.java");
     assertThat(result.longName()).isEqualTo("org.struts.RequestContext");
@@ -273,7 +273,7 @@ public class ComponentDaoTest {
     assertThat(result.moduleUuidPath()).isEqualTo("module_uuid_path_of_U4");
     assertThat(result.getRootUuid()).isEqualTo("U1");
     assertThat(result.projectUuid()).isEqualTo("U1");
-    assertThat(result.key()).isEqualTo("org.struts:struts-core:src/org/struts/RequestContext.java");
+    assertThat(result.getDbKey()).isEqualTo("org.struts:struts-core:src/org/struts/RequestContext.java");
     assertThat(result.path()).isEqualTo("path_of_U4");
     assertThat(result.name()).isEqualTo("RequestContext.java");
     assertThat(result.longName()).isEqualTo("org.struts.RequestContext");
@@ -366,22 +366,22 @@ public class ComponentDaoTest {
     // Sub project of a file
     List<ComponentDto> results = underTest.selectSubProjectsByComponentUuids(dbSession, newArrayList("HIJK"));
     assertThat(results).hasSize(1);
-    assertThat(results.get(0).getKey()).isEqualTo("org.struts:struts-data");
+    assertThat(results.get(0).getDbKey()).isEqualTo("org.struts:struts-data");
 
     // Sub project of a directory
     results = underTest.selectSubProjectsByComponentUuids(dbSession, newArrayList("GHIJ"));
     assertThat(results).hasSize(1);
-    assertThat(results.get(0).getKey()).isEqualTo("org.struts:struts-data");
+    assertThat(results.get(0).getDbKey()).isEqualTo("org.struts:struts-data");
 
     // Sub project of a sub module
     results = underTest.selectSubProjectsByComponentUuids(dbSession, newArrayList("FGHI"));
     assertThat(results).hasSize(1);
-    assertThat(results.get(0).getKey()).isEqualTo("org.struts:struts");
+    assertThat(results.get(0).getDbKey()).isEqualTo("org.struts:struts");
 
     // Sub project of a module
     results = underTest.selectSubProjectsByComponentUuids(dbSession, newArrayList("EFGH"));
     assertThat(results).hasSize(1);
-    assertThat(results.get(0).getKey()).isEqualTo("org.struts:struts");
+    assertThat(results.get(0).getDbKey()).isEqualTo("org.struts:struts");
 
     // Sub project of a project
     assertThat(underTest.selectSubProjectsByComponentUuids(dbSession, newArrayList("ABCD"))).extracting("uuid").containsOnly("ABCD");
@@ -553,7 +553,7 @@ public class ComponentDaoTest {
   @Test
   public void select_provisioned() {
     OrganizationDto organization = db.organizations().insert();
-    ComponentDto provisionedProject = db.components().insertComponent(ComponentTesting.newPrivateProjectDto(organization).setKey("provisioned.project").setName("Provisioned Project"));
+    ComponentDto provisionedProject = db.components().insertComponent(ComponentTesting.newPrivateProjectDto(organization).setDbKey("provisioned.project").setName("Provisioned Project"));
     ComponentDto provisionedView = db.components().insertView(organization);
     String projectUuid = db.components().insertProjectAndSnapshot(ComponentTesting.newPrivateProjectDto(organization)).getComponentUuid();
     String disabledProjectUuid = db.components().insertProjectAndSnapshot(ComponentTesting.newPrivateProjectDto(organization).setEnabled(false)).getComponentUuid();
@@ -579,7 +579,7 @@ public class ComponentDaoTest {
       .containsOnly(provisionedProject.uuid(), provisionedView.uuid());
 
     // match key
-    assertThat(underTest.selectProvisioned(dbSession, organization.getUuid(), provisionedProject.getKey(), projectQualifiers, new RowBounds(0, 10)))
+    assertThat(underTest.selectProvisioned(dbSession, organization.getUuid(), provisionedProject.getDbKey(), projectQualifiers, new RowBounds(0, 10)))
       .extracting(ComponentDto::uuid)
       .containsExactly(provisionedProject.uuid());
     assertThat(underTest.selectProvisioned(dbSession, organization.getUuid(), "pROvisiONed.proJEcT", projectQualifiers, new RowBounds(0, 10)))
@@ -689,7 +689,7 @@ public class ComponentDaoTest {
       .setProjectUuid("ABCD")
       .setModuleUuid("EFGH")
       .setModuleUuidPath(".ABCD.EFGH.")
-      .setKey("org.struts:struts-core:src/org/struts/RequestContext.java")
+      .setDbKey("org.struts:struts-core:src/org/struts/RequestContext.java")
       .setDeprecatedKey("org.struts:struts-core:src/org/struts/RequestContext.java")
       .setName("RequestContext.java")
       .setLongName("org.struts.RequestContext")
@@ -724,7 +724,7 @@ public class ComponentDaoTest {
       .setProjectUuid("ABCD")
       .setModuleUuid("EFGH")
       .setModuleUuidPath(".ABCD.EFGH.")
-      .setKey("org.struts:struts-core:src/org/struts/RequestContext.java")
+      .setDbKey("org.struts:struts-core:src/org/struts/RequestContext.java")
       .setName("RequestContext.java")
       .setLongName("org.struts.RequestContext")
       .setQualifier("FIL")
@@ -835,13 +835,13 @@ public class ComponentDaoTest {
     underTest.updateTags(dbSession, project.setTags(newArrayList("finance", "toto", "tutu")));
     dbSession.commit();
 
-    assertThat(underTest.selectOrFailByKey(dbSession, project.key()).getTags()).containsOnly("finance", "toto", "tutu");
+    assertThat(underTest.selectOrFailByKey(dbSession, project.getDbKey()).getTags()).containsOnly("finance", "toto", "tutu");
   }
 
   @Test
   public void delete() throws Exception {
-    ComponentDto project1 = db.components().insertPrivateProject(db.getDefaultOrganization(), (t) -> t.setKey("PROJECT_1"));
-    db.components().insertPrivateProject(db.getDefaultOrganization(), (t) -> t.setKey("PROJECT_2"));
+    ComponentDto project1 = db.components().insertPrivateProject(db.getDefaultOrganization(), (t) -> t.setDbKey("PROJECT_1"));
+    db.components().insertPrivateProject(db.getDefaultOrganization(), (t) -> t.setDbKey("PROJECT_2"));
 
     underTest.delete(dbSession, project1.getId());
     dbSession.commit();
@@ -935,39 +935,39 @@ public class ComponentDaoTest {
 
   @Test
   public void selectByQuery_key_with_special_characters() {
-    db.components().insertProjectAndSnapshot(ComponentTesting.newPrivateProjectDto(db.organizations().insert()).setKey("project-_%-key"));
+    db.components().insertProjectAndSnapshot(ComponentTesting.newPrivateProjectDto(db.organizations().insert()).setDbKey("project-_%-key"));
 
     ComponentQuery query = ComponentQuery.builder().setNameOrKeyQuery("project-_%-key").setQualifiers(Qualifiers.PROJECT).build();
     List<ComponentDto> result = underTest.selectByQuery(dbSession, query, 0, 10);
 
     assertThat(result).hasSize(1);
-    assertThat(result.get(0).key()).isEqualTo("project-_%-key");
+    assertThat(result.get(0).getDbKey()).isEqualTo("project-_%-key");
   }
 
   @Test
   public void selectByQuery_filter_on_language() {
-    db.components().insertComponent(ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("java-project-key").setLanguage("java"));
-    db.components().insertComponent(ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("cpp-project-key").setLanguage("cpp"));
+    db.components().insertComponent(ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("java-project-key").setLanguage("java"));
+    db.components().insertComponent(ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("cpp-project-key").setLanguage("cpp"));
 
     ComponentQuery query = ComponentQuery.builder().setLanguage("java").setQualifiers(Qualifiers.PROJECT).build();
     List<ComponentDto> result = underTest.selectByQuery(dbSession, query, 0, 10);
 
     assertThat(result).hasSize(1);
-    assertThat(result.get(0).key()).isEqualTo("java-project-key");
+    assertThat(result.get(0).getDbKey()).isEqualTo("java-project-key");
   }
 
   @Test
   public void selectByQuery_filter_on_visibility() {
-    db.components().insertComponent(ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("private-key"));
-    db.components().insertComponent(ComponentTesting.newPublicProjectDto(db.getDefaultOrganization()).setKey("public-key"));
+    db.components().insertComponent(ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("private-key"));
+    db.components().insertComponent(ComponentTesting.newPublicProjectDto(db.getDefaultOrganization()).setDbKey("public-key"));
 
     ComponentQuery privateProjectsQuery = ComponentQuery.builder().setPrivate(true).setQualifiers(Qualifiers.PROJECT).build();
     ComponentQuery publicProjectsQuery = ComponentQuery.builder().setPrivate(false).setQualifiers(Qualifiers.PROJECT).build();
     ComponentQuery allProjectsQuery = ComponentQuery.builder().setPrivate(null).setQualifiers(Qualifiers.PROJECT).build();
 
-    assertThat(underTest.selectByQuery(dbSession, privateProjectsQuery, 0, 10)).extracting(ComponentDto::getKey).containsExactly("private-key");
-    assertThat(underTest.selectByQuery(dbSession, publicProjectsQuery, 0, 10)).extracting(ComponentDto::getKey).containsExactly("public-key");
-    assertThat(underTest.selectByQuery(dbSession, allProjectsQuery, 0, 10)).extracting(ComponentDto::getKey).containsOnly("public-key", "private-key");
+    assertThat(underTest.selectByQuery(dbSession, privateProjectsQuery, 0, 10)).extracting(ComponentDto::getDbKey).containsExactly("private-key");
+    assertThat(underTest.selectByQuery(dbSession, publicProjectsQuery, 0, 10)).extracting(ComponentDto::getDbKey).containsExactly("public-key");
+    assertThat(underTest.selectByQuery(dbSession, allProjectsQuery, 0, 10)).extracting(ComponentDto::getDbKey).containsOnly("public-key", "private-key");
   }
 
   @Test
@@ -1029,11 +1029,11 @@ public class ComponentDaoTest {
     db.components().insertProjectAndSnapshot(project);
     ComponentDto module = newModuleDto(MODULE_UUID, project);
     db.components().insertComponent(module);
-    ComponentDto file1 = newFileDto(project, null, FILE_1_UUID).setKey("file-key-1").setName("File One");
+    ComponentDto file1 = newFileDto(project, null, FILE_1_UUID).setDbKey("file-key-1").setName("File One");
     db.components().insertComponent(file1);
-    ComponentDto file2 = newFileDto(module, null, FILE_2_UUID).setKey("file-key-2").setName("File Two");
+    ComponentDto file2 = newFileDto(module, null, FILE_2_UUID).setDbKey("file-key-2").setName("File Two");
     db.components().insertComponent(file2);
-    ComponentDto file3 = newFileDto(module, null, FILE_3_UUID).setKey("file-key-3").setName("File Three");
+    ComponentDto file3 = newFileDto(module, null, FILE_3_UUID).setDbKey("file-key-3").setName("File Three");
     db.components().insertComponent(file3);
     db.commit();
 
index 6a0f6ba0920dfbef39a97b10740caa66f186801f..95799460b009faabcbfcf7d26a61e879ec8048f2 100644 (file)
@@ -49,10 +49,10 @@ public class ComponentDaoWithDuplicatedKeysTest {
   @Test
   public void select_components_having_same_key() {
     OrganizationDto organizationDto = db.organizations().insert();
-    insertProject(ComponentTesting.newPrivateProjectDto(organizationDto).setKey(PROJECT_KEY));
-    insertProject(ComponentTesting.newPrivateProjectDto(organizationDto).setKey(PROJECT_KEY));
-    insertProject(ComponentTesting.newPrivateProjectDto(organizationDto).setKey(PROJECT_KEY));
-    insertProject(ComponentTesting.newPrivateProjectDto(organizationDto).setKey("ANOTHER_PROJECT_KEY"));
+    insertProject(ComponentTesting.newPrivateProjectDto(organizationDto).setDbKey(PROJECT_KEY));
+    insertProject(ComponentTesting.newPrivateProjectDto(organizationDto).setDbKey(PROJECT_KEY));
+    insertProject(ComponentTesting.newPrivateProjectDto(organizationDto).setDbKey(PROJECT_KEY));
+    insertProject(ComponentTesting.newPrivateProjectDto(organizationDto).setDbKey("ANOTHER_PROJECT_KEY"));
 
     assertThat(underTest.selectComponentsHavingSameKeyOrderedById(db.getSession(), PROJECT_KEY)).hasSize(3);
   }
index 64200c148fa0b00d50d86dd85b87da342fa7038b..b4e997d24bcb6d8e826d1777ca07ced76a1dd53b 100644 (file)
@@ -32,7 +32,7 @@ public class ComponentDtoTest {
   public void setters_and_getters() {
     ComponentDto componentDto = new ComponentDto()
       .setId(1L)
-      .setKey("org.struts:struts-core:src/org/struts/RequestContext.java")
+      .setDbKey("org.struts:struts-core:src/org/struts/RequestContext.java")
       .setDeprecatedKey("org.struts:struts-core:src/org/struts/RequestContext.java")
       .setName("RequestContext.java")
       .setLongName("org.struts.RequestContext")
@@ -46,7 +46,7 @@ public class ComponentDtoTest {
       .setDeveloperUuid("uuid_6");
 
     assertThat(componentDto.getId()).isEqualTo(1L);
-    assertThat(componentDto.key()).isEqualTo("org.struts:struts-core:src/org/struts/RequestContext.java");
+    assertThat(componentDto.getDbKey()).isEqualTo("org.struts:struts-core:src/org/struts/RequestContext.java");
     assertThat(componentDto.deprecatedKey()).isEqualTo("org.struts:struts-core:src/org/struts/RequestContext.java");
     assertThat(componentDto.name()).isEqualTo("RequestContext.java");
     assertThat(componentDto.longName()).isEqualTo("org.struts.RequestContext");
index f8305553ee96997727b4ef93685810fcf0c438af..d1594f7f50411bb59a903c96424a0f66343593fd 100644 (file)
@@ -64,17 +64,17 @@ public class ComponentKeyUpdaterDaoTest {
   @Test
   public void updateKey_does_not_updated_inactive_components() {
     OrganizationDto organizationDto = db.organizations().insert();
-    ComponentDto project = db.components().insertComponent(newPrivateProjectDto(organizationDto, "A").setKey("my_project"));
-    ComponentDto directory = db.components().insertComponent(newDirectory(project, "/directory").setKey("my_project:directory"));
-    db.components().insertComponent(newFileDto(project, directory).setKey("my_project:directory/file"));
-    ComponentDto inactiveDirectory = db.components().insertComponent(newDirectory(project, "/inactive_directory").setKey("my_project:inactive_directory").setEnabled(false));
-    db.components().insertComponent(newFileDto(project, inactiveDirectory).setKey("my_project:inactive_directory/file").setEnabled(false));
+    ComponentDto project = db.components().insertComponent(newPrivateProjectDto(organizationDto, "A").setDbKey("my_project"));
+    ComponentDto directory = db.components().insertComponent(newDirectory(project, "/directory").setDbKey("my_project:directory"));
+    db.components().insertComponent(newFileDto(project, directory).setDbKey("my_project:directory/file"));
+    ComponentDto inactiveDirectory = db.components().insertComponent(newDirectory(project, "/inactive_directory").setDbKey("my_project:inactive_directory").setEnabled(false));
+    db.components().insertComponent(newFileDto(project, inactiveDirectory).setDbKey("my_project:inactive_directory/file").setEnabled(false));
 
     underTest.updateKey(dbSession, "A", "your_project");
     dbSession.commit();
 
     List<ComponentDto> result = dbClient.componentDao().selectAllComponentsFromProjectKey(dbSession, "your_project");
-    assertThat(result).hasSize(5).extracting(ComponentDto::getKey)
+    assertThat(result).hasSize(5).extracting(ComponentDto::getDbKey)
       .containsOnlyOnce("your_project", "your_project:directory", "your_project:directory/file", "my_project:inactive_directory", "my_project:inactive_directory/file");
   }
 
@@ -90,14 +90,14 @@ public class ComponentKeyUpdaterDaoTest {
 
   @Test
   public void bulk_update_key_does_not_update_inactive_components() {
-    ComponentDto project = db.components().insertComponent(newPrivateProjectDto(db.getDefaultOrganization(), "A").setKey("my_project"));
-    db.components().insertComponent(newModuleDto(project).setKey("my_project:module"));
-    db.components().insertComponent(newModuleDto(project).setKey("my_project:inactive_module").setEnabled(false));
+    ComponentDto project = db.components().insertComponent(newPrivateProjectDto(db.getDefaultOrganization(), "A").setDbKey("my_project"));
+    db.components().insertComponent(newModuleDto(project).setDbKey("my_project:module"));
+    db.components().insertComponent(newModuleDto(project).setDbKey("my_project:inactive_module").setEnabled(false));
 
     underTest.bulkUpdateKey(dbSession, "A", "my_", "your_");
 
     List<ComponentDto> result = dbClient.componentDao().selectAllComponentsFromProjectKey(dbSession, "your_project");
-    assertThat(result).hasSize(3).extracting(ComponentDto::getKey)
+    assertThat(result).hasSize(3).extracting(ComponentDto::getDbKey)
       .containsOnlyOnce("your_project", "your_project:module", "my_project:inactive_module");
   }
 
@@ -145,9 +145,9 @@ public class ComponentKeyUpdaterDaoTest {
   @Test
   public void updateKey_throws_IAE_when_sub_component_key_is_too_long() {
     OrganizationDto organizationDto = db.organizations().insert();
-    ComponentDto project = newPrivateProjectDto(organizationDto, "project-uuid").setKey("old-project-key");
+    ComponentDto project = newPrivateProjectDto(organizationDto, "project-uuid").setDbKey("old-project-key");
     db.components().insertComponent(project);
-    db.components().insertComponent(newFileDto(project, null).setKey("old-project-key:file"));
+    db.components().insertComponent(newFileDto(project, null).setDbKey("old-project-key:file"));
     String newLongProjectKey = Strings.repeat("a", 400);
     thrown.expect(IllegalArgumentException.class);
     thrown.expectMessage("Component key length (405) is longer than the maximum authorized (400). '" + newLongProjectKey + ":file' was provided.");
@@ -162,7 +162,7 @@ public class ComponentKeyUpdaterDaoTest {
     thrown.expect(IllegalArgumentException.class);
     thrown.expectMessage("Malformed key for 'my?project?key'. Allowed characters are alphanumeric, '-', '_', '.' and ':', with at least one non-digit.");
 
-    underTest.bulkUpdateKey(dbSession, project.uuid(), project.key(), "my?project?key");
+    underTest.bulkUpdateKey(dbSession, project.uuid(), project.getDbKey(), "my?project?key");
   }
 
   @Test
@@ -179,8 +179,8 @@ public class ComponentKeyUpdaterDaoTest {
   @Test
   public void check_component_keys_checks_inactive_components() {
     OrganizationDto organizationDto = db.organizations().insert();
-    db.components().insertComponent(ComponentTesting.newPrivateProjectDto(organizationDto).setKey("my-project"));
-    db.components().insertComponent(ComponentTesting.newPrivateProjectDto(organizationDto).setKey("your-project").setEnabled(false));
+    db.components().insertComponent(ComponentTesting.newPrivateProjectDto(organizationDto).setDbKey("my-project"));
+    db.components().insertComponent(ComponentTesting.newPrivateProjectDto(organizationDto).setDbKey("your-project").setEnabled(false));
 
     Map<String, Boolean> result = underTest.checkComponentKeys(dbSession, newArrayList("my-project", "your-project", "new-project"));
 
@@ -202,9 +202,9 @@ public class ComponentKeyUpdaterDaoTest {
 
   @Test
   public void simulate_bulk_update_key_do_not_return_disable_components() {
-    ComponentDto project = db.components().insertComponent(newPrivateProjectDto(db.getDefaultOrganization(), "A").setKey("project"));
-    db.components().insertComponent(newModuleDto(project).setKey("project:enabled-module"));
-    db.components().insertComponent(newModuleDto(project).setKey("project:disabled-module").setEnabled(false));
+    ComponentDto project = db.components().insertComponent(newPrivateProjectDto(db.getDefaultOrganization(), "A").setDbKey("project"));
+    db.components().insertComponent(newModuleDto(project).setDbKey("project:enabled-module"));
+    db.components().insertComponent(newModuleDto(project).setDbKey("project:disabled-module").setEnabled(false));
 
     Map<String, String> result = underTest.simulateBulkUpdateKey(dbSession, "A", "project", "new-project");
 
@@ -216,9 +216,9 @@ public class ComponentKeyUpdaterDaoTest {
   @Test
   public void simulate_bulk_update_key_fails_if_invalid_componentKey() {
     OrganizationDto organizationDto = db.organizations().insert();
-    ComponentDto project = db.components().insertComponent(newPrivateProjectDto(organizationDto, "A").setKey("project"));
-    db.components().insertComponent(newModuleDto(project).setKey("project:enabled-module"));
-    db.components().insertComponent(newModuleDto(project).setKey("project:disabled-module").setEnabled(false));
+    ComponentDto project = db.components().insertComponent(newPrivateProjectDto(organizationDto, "A").setDbKey("project"));
+    db.components().insertComponent(newModuleDto(project).setDbKey("project:enabled-module"));
+    db.components().insertComponent(newModuleDto(project).setDbKey("project:disabled-module").setEnabled(false));
 
     thrown.expect(IllegalArgumentException.class);
 
index 45c6707cc64df977c0e68de4c6eb0d76057e97c4..31bcfee757a1892a94bf8f3c2566f41648e327a1 100644 (file)
@@ -44,7 +44,7 @@ public class ComponentTesting {
     String filename = "NAME_" + fileUuid;
     String path = directory != null ? directory.path() + "/" + filename : module.path() + "/" + filename;
     return newChildComponent(fileUuid, module, directory == null ? module : directory)
-      .setKey("KEY_" + fileUuid)
+      .setDbKey("KEY_" + fileUuid)
       .setName(filename)
       .setLongName(path)
       .setScope(Scopes.FILE)
@@ -60,7 +60,7 @@ public class ComponentTesting {
 
   public static ComponentDto newDirectory(ComponentDto module, String uuid, String path) {
     return newChildComponent(uuid, module, module)
-      .setKey(!path.equals("/") ? module.getKey() + ":" + path : module.getKey() + ":/")
+      .setDbKey(!path.equals("/") ? module.getDbKey() + ":" + path : module.getDbKey() + ":/")
       .setName(path)
       .setLongName(path)
       .setPath(path)
@@ -70,7 +70,7 @@ public class ComponentTesting {
 
   public static ComponentDto newSubView(ComponentDto viewOrSubView, String uuid, String key) {
     return newChildComponent(uuid, viewOrSubView, viewOrSubView)
-      .setKey(key)
+      .setDbKey(key)
       .setName(key)
       .setLongName(key)
       .setScope(Scopes.PROJECT)
@@ -85,7 +85,7 @@ public class ComponentTesting {
   public static ComponentDto newModuleDto(String uuid, ComponentDto parentModuleOrProject) {
     return newChildComponent(uuid, parentModuleOrProject, parentModuleOrProject)
       .setModuleUuidPath(parentModuleOrProject.moduleUuidPath() + uuid + UUID_PATH_SEPARATOR)
-      .setKey("KEY_" + uuid)
+      .setDbKey("KEY_" + uuid)
       .setName("NAME_" + uuid)
       .setLongName("LONG_NAME_" + uuid)
       .setPath("module")
@@ -122,7 +122,7 @@ public class ComponentTesting {
       .setProjectUuid(uuid)
       .setModuleUuidPath(UUID_PATH_SEPARATOR + uuid + UUID_PATH_SEPARATOR)
       .setRootUuid(uuid)
-      .setKey("KEY_" + uuid)
+      .setDbKey("KEY_" + uuid)
       .setName("NAME_" + uuid)
       .setLongName("LONG_NAME_" + uuid)
       .setDescription("DESCRIPTION_" + uuid)
@@ -162,7 +162,7 @@ public class ComponentTesting {
     checkNotNull(project.getId(), "The project need to be persisted before creating this technical project.");
     return newChildComponent(uuid, view, view)
       .setUuid(uuid)
-      .setKey(view.key() + project.key())
+      .setDbKey(view.getDbKey() + project.getDbKey())
       .setName(project.name())
       .setLongName(project.longName())
       .setCopyComponentUuid(project.uuid())
index 1692b5451b914146694beb527d38106ed6d13f95..a9541a4762af707b63174410deef8992c6bba6e7 100644 (file)
@@ -182,8 +182,8 @@ public class IssueDaoTest {
 
   private static IssueDto newIssueDto(String key) {
     IssueDto dto = new IssueDto();
-    dto.setComponent(new ComponentDto().setKey("struts:Action").setId(123L).setUuid("component-uuid"));
-    dto.setProject(new ComponentDto().setKey("struts").setId(100L).setUuid("project-uuid"));
+    dto.setComponent(new ComponentDto().setDbKey("struts:Action").setId(123L).setUuid("component-uuid"));
+    dto.setProject(new ComponentDto().setDbKey("struts").setId(100L).setUuid("project-uuid"));
     dto.setRule(RuleTesting.newRule(RuleKey.of("squid", "S001")).setId(200));
     dto.setKee(key);
     dto.setType(2);
@@ -209,8 +209,8 @@ public class IssueDaoTest {
   private void prepareTables() {
     db.rules().insertRule(RULE);
     OrganizationDto organizationDto = db.organizations().insert();
-    ComponentDto projectDto = db.components().insertPrivateProject(organizationDto, (t) -> t.setUuid(PROJECT_UUID).setKey(PROJECT_KEY));
-    db.components().insertComponent(newFileDto(projectDto).setUuid(FILE_UUID).setKey(FILE_KEY));
+    ComponentDto projectDto = db.components().insertPrivateProject(organizationDto, (t) -> t.setUuid(PROJECT_UUID).setDbKey(PROJECT_KEY));
+    db.components().insertComponent(newFileDto(projectDto).setUuid(FILE_UUID).setDbKey(FILE_KEY));
     underTest.insert(db.getSession(), newIssueDto(ISSUE_KEY1)
       .setMessage("the message")
       .setRuleId(RULE.getId())
index 68b25cb340abaa4bdcfd79be77a7e32ff804e32f..40067b96321aaeed159942b857c36fca06873b02 100644 (file)
@@ -420,7 +420,7 @@ public class MeasureDaoTest {
       .setProjectUuid("don't care")
       .setRootUuid("don't care")
       .setUuidPath("don't care")
-      .setKey("kee_" + uuid)
+      .setDbKey("kee_" + uuid)
       .setEnabled(enabled);
     db.getDbClient().componentDao().insert(db.getSession(), componentDto);
     return uuid;
index 38ce4aa72a87c918a04c751df8a9867403cc92e9..b11a447f0b262dbe0c54c4a44920a569d8f20404 100644 (file)
@@ -66,7 +66,7 @@ public class ProjectMeasuresIndexerIteratorTest {
   public void return_project_measure() {
     MetricDto metric1 = insertIntMetric("ncloc");
     MetricDto metric2 = insertIntMetric("coverage");
-    ComponentDto project = ComponentTesting.newPrivateProjectDto(dbTester.getDefaultOrganization()).setKey("Project-Key").setName("Project Name").setTagsString("platform,java");
+    ComponentDto project = ComponentTesting.newPrivateProjectDto(dbTester.getDefaultOrganization()).setDbKey("Project-Key").setName("Project Name").setTagsString("platform,java");
     SnapshotDto analysis = dbTester.components().insertProjectAndSnapshot(project);
     insertMeasure(project, analysis, metric1, 10d);
     insertMeasure(project, analysis, metric2, 20d);
@@ -242,7 +242,7 @@ public class ProjectMeasuresIndexerIteratorTest {
     ProjectMeasures doc = docsById.get(project.uuid());
     assertThat(doc).isNotNull();
     assertThat(doc.getProject().getUuid()).isEqualTo(project.uuid());
-    assertThat(doc.getProject().getKey()).isNotNull().isEqualTo(project.getKey());
+    assertThat(doc.getProject().getKey()).isNotNull().isEqualTo(project.getDbKey());
     assertThat(doc.getProject().getName()).isNotNull().isEqualTo(project.name());
     assertThat(doc.getProject().getAnalysisDate()).isNotNull().isEqualTo(analysis.getCreatedAt());
   }
index 9acec93fd8123f3f911dd18f5d2fce6d3501bea1..e3d4838ade8b17dae85d676e9ba0398932223fea 100644 (file)
@@ -117,7 +117,7 @@ public class PropertiesDaoTest {
     int userId2 = insertUser("user2");
     ComponentDto projectDto = insertProject("PROJECT_A");
     long projectId = projectDto.getId();
-    String projectKey = projectDto.key();
+    String projectKey = projectDto.getDbKey();
 
     // global subscription
     insertProperty("notification.DispatcherWithGlobalSubscribers.Email", "true", null, userId2);
@@ -263,7 +263,7 @@ public class PropertiesDaoTest {
     insertProperty("project.one", "Pone", projectId, null);
     insertProperty("project.two", "Ptwo", projectId, null);
 
-    List<PropertyDto> dtos = underTest.selectProjectProperties(projectDto.key());
+    List<PropertyDto> dtos = underTest.selectProjectProperties(projectDto.getDbKey());
     assertThat(dtos)
       .hasSize(2);
     assertThatDto(findByKey(dtos, "project.one"))
@@ -282,7 +282,7 @@ public class PropertiesDaoTest {
     ComponentDto projectDto = insertProject("A");
     insertProperty("project.one", dbValue, projectDto.getId(), null);
 
-    List<PropertyDto> dtos = underTest.selectProjectProperties(projectDto.key());
+    List<PropertyDto> dtos = underTest.selectProjectProperties(projectDto.getDbKey());
     assertThat(dtos).hasSize(1);
     assertThatDto(dtos.iterator().next())
       .hasKey("project.one")
@@ -1091,7 +1091,7 @@ public class PropertiesDaoTest {
 
   private ComponentDto insertProject(String uuid) {
     String key = "project" + uuid;
-    ComponentDto project = ComponentTesting.newPrivateProjectDto(dbTester.getDefaultOrganization(), uuid).setKey(key);
+    ComponentDto project = ComponentTesting.newPrivateProjectDto(dbTester.getDefaultOrganization(), uuid).setDbKey(key);
     dbClient.componentDao().insert(session, project);
     dbTester.commit();
     return project;
index 8c2bab469c11b732f7aac9c40bd7021f9d51e487..97391a80f54004727fe52ccc78b5c83ac682c95f 100644 (file)
@@ -594,8 +594,8 @@ public class QualityProfileDaoTest {
     assertThat(underTest.selectSelectedProjects(dbSession, organization, profile1, null))
       .extracting("projectId", "projectUuid", "projectKey", "projectName", "profileKey")
       .containsOnly(
-        tuple(project1.getId(), project1.uuid(), project1.key(), project1.name(), profile1.getKee()),
-        tuple(project2.getId(), project2.uuid(), project2.key(), project2.name(), profile1.getKee()));
+        tuple(project1.getId(), project1.uuid(), project1.getDbKey(), project1.name(), profile1.getKee()),
+        tuple(project2.getId(), project2.uuid(), project2.getDbKey(), project2.name(), profile1.getKee()));
 
     assertThat(underTest.selectSelectedProjects(dbSession, organization, profile1, "ect1")).hasSize(1);
     assertThat(underTest.selectSelectedProjects(dbSession, organization, profile3, null)).isEmpty();
@@ -621,8 +621,8 @@ public class QualityProfileDaoTest {
     assertThat(underTest.selectDeselectedProjects(dbSession, organization, profile1, null))
       .extracting("projectId", "projectUuid", "projectKey", "projectName", "profileKey")
       .containsExactly(
-        tuple(project2.getId(), project2.uuid(), project2.key(), project2.name(), null),
-        tuple(project3.getId(), project3.uuid(), project3.key(), project3.name(), null));
+        tuple(project2.getId(), project2.uuid(), project2.getDbKey(), project2.name(), null),
+        tuple(project3.getId(), project3.uuid(), project3.getDbKey(), project3.name(), null));
 
     assertThat(underTest.selectDeselectedProjects(dbSession, organization, profile1, "ect2")).hasSize(1);
     assertThat(underTest.selectDeselectedProjects(dbSession, organization, profile3, null)).hasSize(3);
@@ -648,9 +648,9 @@ public class QualityProfileDaoTest {
     assertThat(underTest.selectProjectAssociations(dbSession, organization, profile1, null))
       .extracting("projectId", "projectUuid", "projectKey", "projectName", "profileKey")
       .containsOnly(
-        tuple(project1.getId(), project1.uuid(), project1.key(), project1.name(), profile1.getKee()),
-        tuple(project2.getId(), project2.uuid(), project2.key(), project2.name(), null),
-        tuple(project3.getId(), project3.uuid(), project3.key(), project3.name(), null));
+        tuple(project1.getId(), project1.uuid(), project1.getDbKey(), project1.name(), profile1.getKee()),
+        tuple(project2.getId(), project2.uuid(), project2.getDbKey(), project2.name(), null),
+        tuple(project3.getId(), project3.uuid(), project3.getDbKey(), project3.name(), null));
 
     assertThat(underTest.selectProjectAssociations(dbSession, organization, profile1, "ect2")).hasSize(1);
     assertThat(underTest.selectProjectAssociations(dbSession, organization, profile3, null)).hasSize(3);
index 4fcc448c83f9699acd6fcfc20d3c9e2b65649015..27bc6c5fc1e80f41994e02baa489d85eccdd5d5c 100644 (file)
@@ -205,7 +205,7 @@ public class CeQueueImpl implements CeQueue {
         ComponentDto component = componentDtoByUuid.get(componentUuid);
         if (component != null) {
           builder.setOrganizationUuid(component.getOrganizationUuid());
-          builder.setComponentKey(component.getKey());
+          builder.setComponentKey(component.getDbKey());
           builder.setComponentName(component.name());
         }
       }
index d7f79bf0e3dfdbbb91977cecbe93195663ef32e3..bfd19284a952a9207c326cc044bf3585bf728489 100644 (file)
@@ -143,7 +143,7 @@ public class IssuesAction implements BatchWsAction {
     if (Scopes.PROJECT.equals(component.scope())) {
       List<ComponentDto> modulesTree = dbClient.componentDao().selectDescendantModules(session, component.uuid());
       for (ComponentDto componentDto : modulesTree) {
-        keysByUUid.put(componentDto.uuid(), componentDto.key());
+        keysByUUid.put(componentDto.uuid(), componentDto.getDbKey());
       }
     } else {
       String moduleUuid = component.moduleUuid();
@@ -151,7 +151,7 @@ public class IssuesAction implements BatchWsAction {
         throw new IllegalArgumentException(String.format("The component '%s' has no module uuid", component.uuid()));
       }
       ComponentDto module = dbClient.componentDao().selectOrFailByUuid(session, moduleUuid);
-      keysByUUid.put(module.uuid(), module.key());
+      keysByUUid.put(module.uuid(), module.getDbKey());
     }
     return keysByUUid;
   }
index 1c7ab2f36f0755fa5a917d12fafd7401bf85fe48..f48bb14fc8609e692dca8128c4478325fb42edc6 100644 (file)
@@ -33,11 +33,11 @@ import org.sonar.db.DbClient;
 import org.sonar.db.DbSession;
 import org.sonar.db.component.ComponentDto;
 import org.sonar.db.component.FilePathWithHashDto;
+import org.sonar.db.permission.OrganizationPermission;
 import org.sonar.db.property.PropertyDto;
 import org.sonar.scanner.protocol.input.FileData;
 import org.sonar.scanner.protocol.input.ProjectRepositories;
 import org.sonar.server.exceptions.ForbiddenException;
-import org.sonar.db.permission.OrganizationPermission;
 import org.sonar.server.user.UserSession;
 
 import static com.google.common.collect.Lists.newArrayList;
@@ -71,8 +71,8 @@ public class ProjectDataLoader {
       checkPermission(query.isIssuesMode(), hasScanPerm, hasBrowsePerm);
 
       ComponentDto project = getProject(module, session);
-      if (!project.key().equals(module.key())) {
-        addSettings(data, module.getKey(), getSettingsFromParents(module, hasScanPerm, session));
+      if (!project.getDbKey().equals(module.getDbKey())) {
+        addSettings(data, module.getDbKey(), getSettingsFromParents(module, hasScanPerm, session));
       }
 
       List<ComponentDto> modulesTree = dbClient.componentDao().selectEnabledDescendantModules(session, module.uuid());
@@ -121,7 +121,7 @@ public class ProjectDataLoader {
 
     Map<String, String> parentProperties = newHashMap();
     for (ComponentDto parent : parents) {
-      parentProperties.putAll(getPropertiesMap(dbClient.propertiesDao().selectProjectProperties(session, parent.key()), hasScanPerm));
+      parentProperties.putAll(getPropertiesMap(dbClient.propertiesDao().selectProjectProperties(session, parent.getDbKey()), hasScanPerm));
     }
     return parentProperties;
   }
@@ -145,8 +145,8 @@ public class ProjectDataLoader {
     addSettings(ref, moduleKey, currentParentProperties);
 
     for (ComponentDto childModule : treeModuleSettings.findChildrenModule(moduleKey)) {
-      addSettings(ref, childModule.getKey(), currentParentProperties);
-      addSettingsToChildrenModules(ref, childModule.getKey(), currentParentProperties, treeModuleSettings, hasScanPerm);
+      addSettings(ref, childModule.getDbKey(), currentParentProperties);
+      addSettingsToChildrenModules(ref, childModule.getDbKey(), currentParentProperties, treeModuleSettings, hasScanPerm);
     }
   }
 
@@ -175,7 +175,7 @@ public class ProjectDataLoader {
   private static void addFileData(ProjectRepositories data, List<ComponentDto> moduleChildren, List<FilePathWithHashDto> files) {
     Map<String, String> moduleKeysByUuid = newHashMap();
     for (ComponentDto module : moduleChildren) {
-      moduleKeysByUuid.put(module.uuid(), module.key());
+      moduleKeysByUuid.put(module.uuid(), module.getDbKey());
     }
 
     for (FilePathWithHashDto file : files) {
@@ -200,7 +200,7 @@ public class ProjectDataLoader {
   private static Map<String, String> moduleUuidsByKey(List<ComponentDto> moduleChildren) {
     Map<String, String> moduleUuidsByKey = newHashMap();
     for (ComponentDto componentDto : moduleChildren) {
-      moduleUuidsByKey.put(componentDto.key(), componentDto.uuid());
+      moduleUuidsByKey.put(componentDto.getDbKey(), componentDto.uuid());
     }
     return moduleUuidsByKey;
   }
@@ -208,7 +208,7 @@ public class ProjectDataLoader {
   private static Map<String, Long> moduleIdsByKey(List<ComponentDto> moduleChildren) {
     Map<String, Long> moduleIdsByKey = newHashMap();
     for (ComponentDto componentDto : moduleChildren) {
-      moduleIdsByKey.put(componentDto.key(), componentDto.getId());
+      moduleIdsByKey.put(componentDto.getDbKey(), componentDto.getId());
     }
     return moduleIdsByKey;
   }
index c71d472597a688737adf81c64fa90c8665f0c5a3..ed6f188082dc9471b5402bf0448d5d3f813a8039 100644 (file)
@@ -138,7 +138,7 @@ public class TaskFormatter {
 
   private static void buildComponent(WsCe.Task.Builder builder, @Nullable ComponentDto componentDto) {
     if (componentDto != null) {
-      builder.setComponentKey(componentDto.getKey());
+      builder.setComponentKey(componentDto.getDbKey());
       builder.setComponentName(componentDto.name());
       builder.setComponentQualifier(componentDto.qualifier());
     }
index a179d61ab294e74db2244c644a9a02af3ff080cd..64200549f4ab4c949bb97d0d09a5a9c651383d1c 100644 (file)
@@ -123,7 +123,7 @@ public class ComponentFinder {
     checkRequest(component.scope().equals(Scopes.PROJECT) && rootQualifiers.contains(component.qualifier()),
       format(
         "Component '%s' (id: %s) must be a project%s.",
-        component.key(), component.uuid(),
+        component.getDbKey(), component.uuid(),
         rootQualifiers.contains(Qualifiers.VIEW) ? " or a view" : ""));
 
     return component;
index fdb5dddf2e3349737da9936c53ebcb64c013265d..4d4d4bcc1926a4285a79ffe84e424a06a40a9114 100644 (file)
@@ -70,7 +70,7 @@ public class ComponentUpdater {
   public ComponentDto create(DbSession dbSession, NewComponent newComponent, @Nullable Integer userId) {
     checkKeyFormat(newComponent.qualifier(), newComponent.key());
     ComponentDto componentDto = createRootComponent(dbSession, newComponent);
-    removeDuplicatedProjects(dbSession, componentDto.getKey());
+    removeDuplicatedProjects(dbSession, componentDto.getDbKey());
     handlePermissionTemplate(dbSession, componentDto, newComponent.getOrganizationUuid(), userId);
     projectIndexers.commitAndIndex(dbSession, singletonList(componentDto), Cause.PROJECT_CREATION);
     return componentDto;
@@ -91,7 +91,7 @@ public class ComponentUpdater {
       .setModuleUuid(null)
       .setModuleUuidPath(ComponentDto.UUID_PATH_SEPARATOR + uuid + ComponentDto.UUID_PATH_SEPARATOR)
       .setProjectUuid(uuid)
-      .setKey(keyWithBranch)
+      .setDbKey(keyWithBranch)
       .setDeprecatedKey(keyWithBranch)
       .setName(newComponent.name())
       .setLongName(newComponent.name())
index cce63e7e2c704c63ef1b204e56bf018ce6ad1fca..2311bedc694f74bfbb3ecf93e62db4fa8502573b 100644 (file)
@@ -185,7 +185,7 @@ public class ComponentIndexer implements ProjectIndexer, NeedAuthorizationIndexe
     return new ComponentDoc()
       .setId(component.uuid())
       .setName(component.name())
-      .setKey(component.key())
+      .setKey(component.getDbKey())
       .setProjectUuid(component.projectUuid())
       .setQualifier(component.qualifier());
   }
index 7b4239406739b401df6390900b6c49fbea4c91d0..38cf7bac235b9eb669d150decb1e51000dbff0f0 100644 (file)
@@ -128,7 +128,7 @@ public class AppAction implements ComponentsWsAction {
       session);
     boolean isFavourite = propertyDtos.size() == 1;
 
-    json.prop("key", component.key());
+    json.prop("key", component.getDbKey());
     json.prop("uuid", component.uuid());
     json.prop("path", component.path());
     json.prop("name", component.name());
@@ -140,9 +140,9 @@ public class AppAction implements ComponentsWsAction {
 
     // Do not display parent project if parent project and project are the same
     boolean displayParentProject = parentProject != null && !parentProject.uuid().equals(project.uuid());
-    json.prop("subProject", displayParentProject ? parentProject.key() : null);
+    json.prop("subProject", displayParentProject ? parentProject.getDbKey() : null);
     json.prop("subProjectName", displayParentProject ? parentProject.longName() : null);
-    json.prop("project", project.key());
+    json.prop("project", project.getDbKey());
     json.prop("projectName", project.longName());
 
     json.prop("fav", isFavourite);
index d7bf90d0e2e9fbed19d30639f944c415f9415168..e229d882783537cd24f09c74ce22685183b0b179 100644 (file)
@@ -58,7 +58,7 @@ class ComponentDtoToWsComponent {
     WsComponents.Component.Builder wsComponent = WsComponents.Component.newBuilder()
       .setOrganization(organizationDtoKey)
       .setId(dto.uuid())
-      .setKey(dto.key())
+      .setKey(dto.getDbKey())
       .setName(dto.name())
       .setQualifier(dto.qualifier());
     setNullable(emptyToNull(dto.path()), wsComponent::setPath);
index 1674f6de9e2f36f18af655b3112efe0d52dc50e2..d5bca61331e50f204cb9b2afbd3349006b2d1b03 100644 (file)
@@ -135,7 +135,7 @@ public class SearchAction implements ComponentsWsAction {
       .map(ComponentDto::projectUuid)
       .collect(toHashSet());
     List<ComponentDto> projects = dbClient.componentDao().selectByUuids(dbSession, projectUuidsToSearch);
-    return projects.stream().collect(toMap(ComponentDto::uuid, ComponentDto::key));
+    return projects.stream().collect(toMap(ComponentDto::uuid, ComponentDto::getDbKey));
   }
 
   private static ComponentQuery buildQuery(SearchWsRequest request) {
@@ -191,7 +191,7 @@ public class SearchAction implements ComponentsWsAction {
     WsComponents.Component.Builder builder = WsComponents.Component.newBuilder()
       .setOrganization(organization.getKey())
       .setId(dto.uuid())
-      .setKey(dto.key())
+      .setKey(dto.getDbKey())
       .setProject(projectKey)
       .setName(dto.name())
       .setQualifier(dto.qualifier());
index f941474f968ca2b680d636023cb124f63ed5dbd7..d6faf28ef75f57ca1b2e3d0d435cfbc9801ea8f5 100644 (file)
@@ -424,7 +424,7 @@ public class SearchProjectsAction implements ComponentsWsAction {
         .clear()
         .setOrganization(organizationDto.getKey())
         .setId(dbComponent.uuid())
-        .setKey(dbComponent.key())
+        .setKey(dbComponent.getDbKey())
         .setName(dbComponent.name())
         .setVisibility(Visibility.getLabel(dbComponent.isPrivate()));
       wsComponent.getTagsBuilder().addAllTags(dbComponent.getTags());
index b770207aa559b179c2d3e7d140e817d33ffd38ab..dbc6953d94dfb9aec7de41994cb3efc8bf68de54 100644 (file)
@@ -35,9 +35,9 @@ import java.util.stream.Collectors;
 import java.util.stream.Stream;
 import javax.annotation.CheckForNull;
 import javax.annotation.Nullable;
+import org.sonar.api.resources.Qualifiers;
 import org.sonar.api.resources.ResourceType;
 import org.sonar.api.resources.ResourceTypes;
-import org.sonar.api.resources.Qualifiers;
 import org.sonar.api.server.ws.Change;
 import org.sonar.api.server.ws.Request;
 import org.sonar.api.server.ws.Response;
@@ -217,7 +217,7 @@ public class SuggestionsAction implements ComponentsWsAction {
     }
 
     List<ComponentDto> favorites = favoriteFinder.list();
-    Set<String> favoriteKeys = favorites.stream().map(ComponentDto::getKey).collect(MoreCollectors.toSet(favorites.size()));
+    Set<String> favoriteKeys = favorites.stream().map(ComponentDto::getDbKey).collect(MoreCollectors.toSet(favorites.size()));
     ComponentIndexQuery.Builder queryBuilder = ComponentIndexQuery.builder()
       .setQuery(query)
       .setRecentlyBrowsedKeys(recentlyBrowsedKeys)
@@ -343,13 +343,13 @@ public class SuggestionsAction implements ComponentsWsAction {
     checkState(organizationKey != null, "Organization with uuid '%s' not found", result.getOrganizationUuid());
     Suggestion.Builder builder = Suggestion.newBuilder()
       .setOrganization(organizationKey)
-      .setKey(result.getKey())
+      .setKey(result.getDbKey())
       .setName(result.name())
       .setMatch(hit.getHighlightedText().orElse(HtmlEscapers.htmlEscaper().escape(result.name())))
-      .setIsRecentlyBrowsed(recentlyBrowsedKeys.contains(result.getKey()))
+      .setIsRecentlyBrowsed(recentlyBrowsedKeys.contains(result.getDbKey()))
       .setIsFavorite(favoriteUuids.contains(result.uuid()));
     if (QUALIFIERS_FOR_WHICH_TO_RETURN_PROJECT.contains(result.qualifier())) {
-      builder.setProject(projectsByUuids.get(result.projectUuid()).getKey());
+      builder.setProject(projectsByUuids.get(result.projectUuid()).getDbKey());
     }
     return builder.build();
   }
@@ -366,7 +366,7 @@ public class SuggestionsAction implements ComponentsWsAction {
   private static List<Project> toProjects(Map<String, ComponentDto> projectsByUuids) {
     return projectsByUuids.values().stream()
       .map(p -> Project.newBuilder()
-        .setKey(p.key())
+        .setKey(p.getDbKey())
         .setName(p.longName())
         .build())
       .collect(Collectors.toList());
index 96d358fa201be1aa9fbf95aa1ef68dbd73280ea3..058deb8d2e721038fad6a1d10207d9450413e8ca 100644 (file)
@@ -65,8 +65,8 @@ import static org.sonar.db.component.ComponentTreeQuery.Strategy.LEAVES;
 import static org.sonar.server.component.ComponentFinder.ParamNames.COMPONENT_ID_AND_COMPONENT;
 import static org.sonar.server.component.ws.ComponentDtoToWsComponent.componentDtoToWsComponent;
 import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
-import static org.sonar.server.ws.WsParameterBuilder.QualifierParameterContext.newQualifierParameterContext;
 import static org.sonar.server.ws.WsParameterBuilder.createQualifiersParameter;
+import static org.sonar.server.ws.WsParameterBuilder.QualifierParameterContext.newQualifierParameterContext;
 import static org.sonar.server.ws.WsUtils.checkRequest;
 import static org.sonar.server.ws.WsUtils.writeProtobuf;
 import static org.sonarqube.ws.client.component.ComponentsWsParameters.ACTION_TREE;
@@ -223,7 +223,7 @@ public class TreeAction implements ComponentsWsAction {
     ComponentDto referenceComponent = referenceComponentsByUuid.get(component.getCopyResourceUuid());
     if (referenceComponent != null) {
       wsComponent.setRefId(referenceComponent.uuid());
-      wsComponent.setRefKey(referenceComponent.key());
+      wsComponent.setRefKey(referenceComponent.getDbKey());
     }
 
     return wsComponent;
index 6a187736aa5002eecdf97a8eafe34ec22814643f..bd0cbb8d743afa8ca06a8d80bf1ee96a0bb5629b 100644 (file)
@@ -34,10 +34,10 @@ import org.sonar.db.DbSession;
 import org.sonar.db.ce.CeTaskTypes;
 import org.sonar.db.component.ComponentDto;
 import org.sonar.db.organization.OrganizationDto;
+import org.sonar.db.permission.OrganizationPermission;
 import org.sonar.server.component.ComponentUpdater;
 import org.sonar.server.component.NewComponent;
 import org.sonar.server.exceptions.NotFoundException;
-import org.sonar.db.permission.OrganizationPermission;
 import org.sonar.server.permission.PermissionTemplateService;
 import org.sonar.server.user.UserSession;
 
@@ -102,7 +102,7 @@ public class ReportSubmitter {
     if (project.isPresent()) {
       checkArgument(project.get().getOrganizationUuid().equals(organizationDto.getUuid()),
         "Organization of component with key '%s' does not match specified organization '%s'",
-        project.get().key(), organizationDto.getKey());
+        project.get().getDbKey(), organizationDto.getKey());
     }
   }
 
index f050e817ad8b3f0142fffb5dbcda089f9726d083..393e79f99ae529db26200065e57c3e16816c3d47 100644 (file)
@@ -34,7 +34,7 @@ public class UuidFactory {
     try (DbSession dbSession = dbClient.openSession(false)) {
       List<ComponentDto> components = dbClient.componentDao().selectAllComponentsFromProjectKey(dbSession, rootKey);
       for (ComponentDto componentDto : components) {
-        uuidsByKey.put(componentDto.getKey(), componentDto.uuid());
+        uuidsByKey.put(componentDto.getDbKey(), componentDto.uuid());
       }
     }
   }
index df6c144f05f696baf9e7a7364cf713ba37020387..6e6341dad9b6524a06c01084c1c5646595802dd0 100644 (file)
@@ -161,7 +161,7 @@ public class FileMoveDetectionStep implements ComputationStep {
           .setStrategy(Strategy.LEAVES)
           .build());
       return from(componentDtos)
-        .transform(componentDto -> new DbComponent(componentDto.getId(), componentDto.key(), componentDto.uuid(), componentDto.path()))
+        .transform(componentDto -> new DbComponent(componentDto.getId(), componentDto.getDbKey(), componentDto.uuid(), componentDto.path()))
         .uniqueIndex(DbComponent::getKey);
     }
   }
index 387e1b4816ce27714210254eaa662a857d2249dc..985b2f60fb7d549b14ae077830f7587e741bd563 100644 (file)
@@ -137,7 +137,7 @@ public class PersistComponentsStep implements ComputationStep {
   private Map<String, ComponentDto> indexExistingDtosByKey(DbSession session) {
     return dbClient.componentDao().selectAllComponentsFromProjectKey(session, treeRootHolder.getRoot().getKey())
       .stream()
-      .collect(java.util.stream.Collectors.toMap(ComponentDto::key, Function.identity()));
+      .collect(java.util.stream.Collectors.toMap(ComponentDto::getDbKey, Function.identity()));
   }
 
   private class PersistComponentStepsVisitor extends PathAwareVisitorAdapter<ComponentDtoHolder> {
@@ -220,7 +220,7 @@ public class PersistComponentsStep implements ComputationStep {
     }
 
     private ComponentDto persistComponent(ComponentDto componentDto) {
-      ComponentDto existingComponent = existingComponentDtosByKey.remove(componentDto.getKey());
+      ComponentDto existingComponent = existingComponentDtosByKey.remove(componentDto.getDbKey());
       if (existingComponent == null) {
         dbClient.componentDao().insert(dbSession, componentDto);
         return componentDto;
@@ -366,7 +366,7 @@ public class PersistComponentsStep implements ComputationStep {
     ComponentDto componentDto = new ComponentDto();
     componentDto.setOrganizationUuid(analysisMetadataHolder.getOrganization().getUuid());
     componentDto.setUuid(componentUuid);
-    componentDto.setKey(componentKey);
+    componentDto.setDbKey(componentKey);
     componentDto.setDeprecatedKey(componentKey);
     componentDto.setEnabled(true);
     componentDto.setCreatedAt(new Date(system2.now()));
index aff50f630b36abb9b73c2f0d6aa02cf415dbb414..6c7ff308160c800ba42535af82e944a589be5656 100644 (file)
@@ -79,7 +79,7 @@ public class ValidateProjectStep implements ComputationStep {
     try (DbSession dbSession = dbClient.openSession(false)) {
       Component root = treeRootHolder.getRoot();
       List<ComponentDto> baseModules = dbClient.componentDao().selectEnabledModulesFromProjectKey(dbSession, root.getKey());
-      Map<String, ComponentDto> baseModulesByKey = from(baseModules).uniqueIndex(ComponentDto::key);
+      Map<String, ComponentDto> baseModulesByKey = from(baseModules).uniqueIndex(ComponentDto::getDbKey);
       ValidateProjectsVisitor visitor = new ValidateProjectsVisitor(dbSession, dbClient.componentDao(), baseModulesByKey);
       new DepthTraversalTypeAwareCrawler(visitor).visit(root);
 
@@ -138,7 +138,7 @@ public class ValidateProjectStep implements ComputationStep {
         ComponentDto anotherBaseProject = componentDao.selectOrFailByUuid(session, baseProject.get().projectUuid());
         validationMessages.add(format("The project \"%s\" is already defined in SonarQube but as a module of project \"%s\". "
           + "If you really want to stop directly analysing project \"%s\", please first delete it from SonarQube and then relaunch the analysis of project \"%s\".",
-          rawProjectKey, anotherBaseProject.key(), anotherBaseProject.key(), rawProjectKey));
+          rawProjectKey, anotherBaseProject.getDbKey(), anotherBaseProject.getDbKey(), rawProjectKey));
       }
     }
 
@@ -181,7 +181,7 @@ public class ValidateProjectStep implements ComputationStep {
     private void validateModuleKeyIsNotAlreadyUsedInAnotherProject(ComponentDto baseModule, String rawModuleKey) {
       if (!baseModule.projectUuid().equals(baseModule.uuid()) && !baseModule.projectUuid().equals(rawProject.getUuid())) {
         ComponentDto projectModule = componentDao.selectOrFailByUuid(session, baseModule.projectUuid());
-        validationMessages.add(format("Module \"%s\" is already part of project \"%s\"", rawModuleKey, projectModule.key()));
+        validationMessages.add(format("Module \"%s\" is already part of project \"%s\"", rawModuleKey, projectModule.getDbKey()));
       }
     }
 
index 9e61f6074055c48cbd1d75032d3d58db69852805..58e1ac2e7ae6238dc49d77162cbffd404af91368 100644 (file)
@@ -73,7 +73,7 @@ public class ShowResponseBuilder {
     String ref = null;
     ComponentDto componentDto = duplication.file();
     if (componentDto != null) {
-      String componentKey = componentDto.key();
+      String componentKey = componentDto.getDbKey();
       ref = refByComponentKey.get(componentKey);
       if (ref == null) {
         ref = Integer.toString(refByComponentKey.size() + 1);
@@ -91,19 +91,19 @@ public class ShowResponseBuilder {
 
   private static WsDuplications.File toWsFile(ComponentDto file, @Nullable ComponentDto project, @Nullable ComponentDto subProject) {
     WsDuplications.File.Builder wsFile = WsDuplications.File.newBuilder();
-    wsFile.setKey(file.key());
+    wsFile.setKey(file.getDbKey());
     wsFile.setUuid(file.uuid());
     wsFile.setName(file.longName());
 
     if (project != null) {
-      wsFile.setProject(project.key());
+      wsFile.setProject(project.getDbKey());
       wsFile.setProjectUuid(project.uuid());
       wsFile.setProjectName(project.longName());
 
       // Do not return sub project if sub project and project are the same
       boolean displaySubProject = subProject != null && !subProject.uuid().equals(project.uuid());
       if (displaySubProject) {
-        wsFile.setSubProject(subProject.key());
+        wsFile.setSubProject(subProject.getDbKey());
         wsFile.setSubProjectUuid(subProject.uuid());
         wsFile.setSubProjectName(subProject.longName());
       }
index a4a0dddd8569bf32d9d6f7ba983338ec4737e08e..f287cc45c8681aa7ce913f6e87be316d0ef53a83 100644 (file)
@@ -52,7 +52,7 @@ public class FavoriteUpdater {
       .setUserId(userId)
       .setComponentId(componentDto.getId())
       .build(), dbSession);
-    checkRequest(existingFavoriteOnComponent.isEmpty(), "Component '%s' is already a favorite", componentDto.getKey());
+    checkRequest(existingFavoriteOnComponent.isEmpty(), "Component '%s' is already a favorite", componentDto.getDbKey());
     dbClient.propertiesDao().saveProperty(dbSession, new PropertyDto()
       .setKey(PROP_FAVORITE_KEY)
       .setResourceId(componentDto.getId())
@@ -72,6 +72,6 @@ public class FavoriteUpdater {
       .setKey(PROP_FAVORITE_KEY)
       .setResourceId(component.getId())
       .setUserId(userId));
-    checkRequest(result == 1, "Component '%s' is not a favorite", component.key());
+    checkRequest(result == 1, "Component '%s' is not a favorite", component.getDbKey());
   }
 }
index 800345779c9bb682c8fe7df9a319abf2bb94649c..a3bfca0621e545a5930d5fea2b40fffacde6e736 100644 (file)
@@ -153,7 +153,7 @@ public class SearchAction implements FavoritesWsAction {
     builder
       .clear()
       .setOrganization(organization.getKey())
-      .setKey(componentDto.key());
+      .setKey(componentDto.getDbKey());
     setNullable(componentDto.name(), builder::setName);
     setNullable(componentDto.qualifier(), builder::setQualifier);
     return builder.build();
index 1c495c803f860bd1c7bafaaedf9b0457ceb44b7f..b10635e43541781b281830e10fa852507d5c9194 100644 (file)
@@ -80,7 +80,7 @@ public class IssueUpdater {
       .setIssue(issue)
       .setChangeAuthorLogin(context.login())
       .setRuleName(rule.map(RuleDefinitionDto::getName).orElse(null))
-      .setProject(project.getKey(), project.name())
+      .setProject(project.getDbKey(), project.name())
       .setComponent(component)
       .setComment(comment));
     return issueDto;
index 43a66e25b9f79cd628ea5a299ecc5319940cd78e..7c91d749fd86be68052fa63daa12892bc080fdbb 100644 (file)
@@ -56,7 +56,7 @@ public class IssueChangeNotification extends Notification {
 
   public IssueChangeNotification setProject(ComponentDto project) {
     setFieldValue("projectName", project.longName());
-    setFieldValue("projectKey", project.key());
+    setFieldValue("projectKey", project.getDbKey());
     return this;
   }
 
index 8dc3d5458dd2ad288be3cba37a0ad070b0d4b947..ac05cc4e49864bd5e4eaf0278a44af304087830e 100644 (file)
@@ -160,13 +160,13 @@ public class SearchResponseFormat {
 
     ComponentDto component = data.getComponentByUuid(dto.getComponentUuid());
     issueBuilder.setOrganization(data.getOrganizationKey(component.getOrganizationUuid()));
-    issueBuilder.setComponent(component.key());
+    issueBuilder.setComponent(component.getDbKey());
     ComponentDto project = data.getComponentByUuid(dto.getProjectUuid());
     if (project != null) {
-      issueBuilder.setProject(project.getKey());
+      issueBuilder.setProject(project.getDbKey());
       ComponentDto subProject = data.getComponentByUuid(dto.getModuleUuid());
-      if (subProject != null && !subProject.getKey().equals(project.getKey())) {
-        issueBuilder.setSubProject(subProject.getKey());
+      if (subProject != null && !subProject.getDbKey().equals(project.getDbKey())) {
+        issueBuilder.setSubProject(subProject.getDbKey());
       }
     }
     issueBuilder.setRule(dto.getRuleKey().toString());
@@ -300,7 +300,7 @@ public class SearchResponseFormat {
       String uuid = dto.uuid();
       Component.Builder builder = Component.newBuilder()
         .setOrganization(data.getOrganizationKey(dto.getOrganizationUuid()))
-        .setKey(dto.key())
+        .setKey(dto.getDbKey())
         .setUuid(uuid)
         .setQualifier(dto.qualifier())
         .setName(nullToEmpty(dto.name()))
index 77fa8a5b117ea66f05e14e291ce48fb2d7afe064..568b92490afe7e7781bd0d8f12057f243fc6cf25 100644 (file)
@@ -134,14 +134,14 @@ public class CreateAction implements CustomMeasuresWsAction {
   }
 
   private static void checkIsProjectOrModule(ComponentDto component) {
-    checkRequest(Scopes.PROJECT.equals(component.scope()), "Component '%s' (id: %s) must be a project or a module.", component.key(), component.uuid());
+    checkRequest(Scopes.PROJECT.equals(component.scope()), "Component '%s' (id: %s) must be a project or a module.", component.getDbKey(), component.uuid());
   }
 
   private void checkMeasureDoesNotExistAlready(DbSession dbSession, ComponentDto component, MetricDto metric) {
     int nbMeasuresOnSameMetricAndMeasure = dbClient.customMeasureDao().countByComponentIdAndMetricId(dbSession, component.uuid(), metric.getId());
     checkRequest(nbMeasuresOnSameMetricAndMeasure == 0,
       "A measure already exists for project '%s' (id: %s) and metric '%s' (id: '%d')",
-      component.key(), component.uuid(), metric.getKey(), metric.getId());
+      component.getDbKey(), component.uuid(), metric.getKey(), metric.getId());
   }
 
   private MetricDto searchMetric(DbSession dbSession, Request request) {
index 2356df53851cb4d59d8df3792bfc51c08646a87c..a30d8d6c55cb2566635c94121795f7247c786bcd 100644 (file)
@@ -69,7 +69,7 @@ public class CustomMeasureJsonWriter {
       MetricJsonWriter.write(json, metric, MetricJsonWriter.MANDATORY_FIELDS);
     }
     writeIfNeeded(json, component.uuid(), FIELD_PROJECT_ID, fieldsToReturn);
-    writeIfNeeded(json, component.key(), FIELD_PROJECT_KEY, fieldsToReturn);
+    writeIfNeeded(json, component.getDbKey(), FIELD_PROJECT_KEY, fieldsToReturn);
     writeIfNeeded(json, new Date(measure.getCreatedAt()), FIELD_CREATED_AT, fieldsToReturn);
     writeIfNeeded(json, new Date(measure.getUpdatedAt()), FIELD_UPDATED_AT, fieldsToReturn);
     writeIfNeeded(json, isPending, FIELD_PENDING, fieldsToReturn);
index 301792a565d18b3ad5b3a95dd22035ad557b5830..df45ff19672a443d81ea1ceed45bcf97d5a8a3d4 100644 (file)
@@ -38,7 +38,7 @@ class ComponentDtoToWsComponent {
     ComponentDto referenceComponent = referenceComponentsByUuid.get(component.getCopyResourceUuid());
     if (referenceComponent != null) {
       wsComponent.setRefId(referenceComponent.uuid());
-      wsComponent.setRefKey(referenceComponent.key());
+      wsComponent.setRefKey(referenceComponent.getDbKey());
     }
 
     WsMeasures.Measure.Builder measureBuilder = WsMeasures.Measure.newBuilder();
@@ -54,7 +54,7 @@ class ComponentDtoToWsComponent {
   static Component.Builder componentDtoToWsComponent(ComponentDto component) {
     Component.Builder wsComponent = Component.newBuilder()
       .setId(component.uuid())
-      .setKey(component.key())
+      .setKey(component.getDbKey())
       .setName(component.name())
       .setQualifier(component.qualifier());
     if (component.path() != null) {
index 5ceb61ff331ce68c823185d0a630e2d5ab6e36ab..4efe151b8a4318947b77b880703923105435b207 100644 (file)
@@ -317,7 +317,7 @@ public class ComponentTreeAction implements MeasuresWsAction {
     ComponentDto referenceComponent = referenceComponentsByUuid.get(component.getCopyResourceUuid());
     if (referenceComponent != null) {
       wsComponent.setRefId(referenceComponent.uuid());
-      wsComponent.setRefKey(referenceComponent.key());
+      wsComponent.setRefKey(referenceComponent.getDbKey());
     }
     WsMeasures.Measure.Builder measureBuilder = WsMeasures.Measure.newBuilder();
     for (Map.Entry<MetricDto, ComponentTreeData.Measure> entry : measures.entrySet()) {
index cba61152db2950f2e0d8f6252d8ef4c187a3f6a6..88ec4dc255fcf713f6daf7fa9a88119707e103c7 100644 (file)
@@ -176,7 +176,7 @@ public class SearchAction implements MeasuresWsAction {
 
     private List<Measure> buildWsMeasures() {
       Map<String, ComponentDto> componentsByUuid = projects.stream().collect(toMap(ComponentDto::uuid, Function.identity()));
-      Map<String, String> componentNamesByKey = projects.stream().collect(toMap(ComponentDto::key, ComponentDto::name));
+      Map<String, String> componentNamesByKey = projects.stream().collect(toMap(ComponentDto::getDbKey, ComponentDto::name));
       Map<Integer, MetricDto> metricsById = metrics.stream().collect(toMap(MetricDto::getId, identity()));
 
       Function<MeasureDto, MetricDto> dbMeasureToDbMetric = dbMeasure -> metricsById.get(dbMeasure.getMetricId());
@@ -187,7 +187,7 @@ public class SearchAction implements MeasuresWsAction {
       return measures.stream()
         .map(dbMeasure -> {
           updateMeasureBuilder(measureBuilder, dbMeasureToDbMetric.apply(dbMeasure), dbMeasure);
-          measureBuilder.setComponent(componentsByUuid.get(dbMeasure.getComponentUuid()).getKey());
+          measureBuilder.setComponent(componentsByUuid.get(dbMeasure.getComponentUuid()).getDbKey());
           Measure measure = measureBuilder.build();
           measureBuilder.clear();
           return measure;
index b1b634b389c6ae2ce07f5428e06ee3204a0569c2..3a81c95f56bb7657f5251c7e04d0f3222469fb76 100644 (file)
@@ -204,7 +204,7 @@ public class ListAction implements NotificationsWsAction {
     checkArgument(organizationDto != null, "No organization for uuid '%s'", organizationUuid);
 
     return notification.setOrganization(organizationDto.getKey())
-      .setProject(project.getKey())
+      .setProject(project.getDbKey())
       .setProjectName(project.name());
   }
 
index d0cc6054c19f865ea1de5cae36bae2fcfc0bedad..c6766c405b47cfc777d055907f806429fd15f463 100644 (file)
@@ -80,7 +80,7 @@ public class PermissionTemplateService {
     }
 
     String effectiveKey = ComponentKeys.createKey(projectKey, branch);
-    ComponentDto dto = new ComponentDto().setOrganizationUuid(organizationUuid).setKey(effectiveKey).setQualifier(qualifier);
+    ComponentDto dto = new ComponentDto().setOrganizationUuid(organizationUuid).setDbKey(effectiveKey).setQualifier(qualifier);
     PermissionTemplateDto template = findTemplate(dbSession, organizationUuid, dto);
     if (template == null) {
       return false;
@@ -190,11 +190,11 @@ public class PermissionTemplateService {
     List<PermissionTemplateDto> matchingTemplates = new ArrayList<>();
     for (PermissionTemplateDto permissionTemplateDto : allPermissionTemplates) {
       String keyPattern = permissionTemplateDto.getKeyPattern();
-      if (StringUtils.isNotBlank(keyPattern) && component.getKey().matches(keyPattern)) {
+      if (StringUtils.isNotBlank(keyPattern) && component.getDbKey().matches(keyPattern)) {
         matchingTemplates.add(permissionTemplateDto);
       }
     }
-    checkAtMostOneMatchForComponentKey(component.getKey(), matchingTemplates);
+    checkAtMostOneMatchForComponentKey(component.getDbKey(), matchingTemplates);
     if (matchingTemplates.size() == 1) {
       return matchingTemplates.get(0);
     }
index 7010d034360cd5f5e5f6f334996818d477ed401c..83adbbed00bb30827ec49c60417fabeea478993d 100644 (file)
@@ -142,7 +142,7 @@ public class SearchProjectPermissionsAction implements PermissionsWsAction {
       rootComponentBuilder
         .clear()
         .setId(rootComponent.uuid())
-        .setKey(rootComponent.key())
+        .setKey(rootComponent.getDbKey())
         .setQualifier(rootComponent.qualifier())
         .setName(rootComponent.name());
       for (String permission : data.permissions(rootComponent.getId())) {
index 4a3c14fbb0ad5f067328e944928765dae5b0262b..76e31ce5077d574eda29af1d2e37a57f0d8b5caf 100644 (file)
@@ -147,7 +147,7 @@ public class CreateAction implements ProjectsWsAction {
   private static CreateWsResponse toCreateResponse(ComponentDto componentDto) {
     return CreateWsResponse.newBuilder()
       .setProject(CreateWsResponse.Project.newBuilder()
-        .setKey(componentDto.key())
+        .setKey(componentDto.getDbKey())
         .setName(componentDto.name())
         .setQualifier(componentDto.qualifier())
         .setVisibility(Visibility.getLabel(componentDto.isPrivate())))
index 4605d58e45d67fca18e82cb20f2b9095cef489a6..f8945203a180a309838ad898504f1c9f905aff02 100644 (file)
@@ -123,7 +123,7 @@ public class GhostsAction implements ProjectsWsAction {
     for (ComponentDto project : projects) {
       json.beginObject();
       json.prop("uuid", project.uuid());
-      writeIfWished(json, "key", project.key(), fieldsToReturn);
+      writeIfWished(json, "key", project.getDbKey(), fieldsToReturn);
       writeIfWished(json, "name", project.name(), fieldsToReturn);
       writeIfWished(json, "creationDate", project.getCreatedAt(), fieldsToReturn);
       writeIfWished(json, "visibility", project.isPrivate() ? PRIVATE.getLabel() : PUBLIC.getLabel(), fieldsToReturn);
index 6e3836f783c66b4f3fdcc4e66efd9d99139fdea7..3a752c5b5ce2a39d8b8b4e8a98ac15f875eaf2be 100644 (file)
@@ -134,7 +134,7 @@ public class IndexAction implements ProjectsWsAction {
   private static void addProject(JsonWriter json, ComponentDto project) {
     json.beginObject()
       .prop("id", project.getId())
-      .prop("k", project.getKey())
+      .prop("k", project.getDbKey())
       .prop("nm", project.name())
       .prop("sc", project.scope())
       .prop("qu", project.qualifier())
index 3bcda13deb18d0c72b0251b6a9cac801a2138ed0..c0e208810c42c11a171c4f653cce634f1704f789 100644 (file)
@@ -124,7 +124,7 @@ public class ProvisionedAction implements ProjectsWsAction {
   private static List<Component> writeProjects(List<ComponentDto> projects, Set<String> desiredFields) {
     return projects.stream().map(project -> {
       Component.Builder compBuilder = Component.newBuilder().setUuid(project.uuid());
-      writeIfNeeded("key", project.key(), compBuilder::setKey, desiredFields);
+      writeIfNeeded("key", project.getDbKey(), compBuilder::setKey, desiredFields);
       writeIfNeeded("name", project.name(), compBuilder::setName, desiredFields);
       writeIfNeeded("creationDate", project.getCreatedAt(), compBuilder::setCreationDate, desiredFields);
       writeIfNeeded("visibility", project.isPrivate() ? PRIVATE.getLabel() : PUBLIC.getLabel(), compBuilder::setVisibility, desiredFields);
index 2fa5a29ad941a237c29734bea1206a9d9a2eb91e..db5a30ff61a5531990880261deb5d0a15297058c 100644 (file)
@@ -169,7 +169,7 @@ public class SearchAction implements ProjectsWsAction {
     Component.Builder builder = Component.newBuilder()
       .setOrganization(organization.getKey())
       .setId(dto.uuid())
-      .setKey(dto.key())
+      .setKey(dto.getDbKey())
       .setName(dto.name())
       .setQualifier(dto.qualifier())
       .setVisibility(dto.isPrivate() ? PRIVATE.getLabel() : PUBLIC.getLabel());
index 421a6e68629e7c22a9428574dc34347ce30cd747..a3e07082fc2215e6f6f5f842ee967ce8c6e00a4f 100644 (file)
@@ -121,7 +121,7 @@ public class SearchMyProjectsAction implements ProjectsWsAction {
       Project.Builder project = Project.newBuilder();
       project
         .setId(dto.uuid())
-        .setKey(dto.key())
+        .setKey(dto.getDbKey())
         .setName(dto.name());
       data.lastAnalysisDateFor(dto.uuid()).ifPresent(project::setLastAnalysisDate);
       data.qualityGateStatusFor(dto.uuid()).ifPresent(project::setQualityGate);
index b46278cde7cb4193dd73d5b0343d7855600beda0..f3f55e9e3313cde80adba2a1fd1496f97f39bd7c 100644 (file)
@@ -94,7 +94,7 @@ public class SetAction implements ProjectTagsWsAction {
 
     try (DbSession dbSession = dbClient.openSession(false)) {
       ComponentDto project = componentFinder.getByKey(dbSession, projectKey);
-      checkRequest(PROJECT.equals(project.qualifier()), "Component '%s' is not a project", project.key());
+      checkRequest(PROJECT.equals(project.qualifier()), "Component '%s' is not a project", project.getDbKey());
       userSession.checkComponentPermission(UserRole.ADMIN, project);
 
       project.setTags(tags);
index e8b28c8ccad9e7ead03742d5d59152667844cb89..3f9709faab2962b8a409af11c2fdd398c6129159 100644 (file)
@@ -175,7 +175,7 @@ public class SearchAction implements QProfileWsAction {
 
     ComponentDto project = componentFinder.getByKey(dbSession, request.getProjectKey());
     if (!project.getOrganizationUuid().equals(organization.getUuid())) {
-      throw new NotFoundException(format("Component key '%s' not found", project.getKey()));
+      throw new NotFoundException(format("Component key '%s' not found", project.getDbKey()));
     }
     if (project.isRoot()) {
       return project;
index 600c53a917ae145dc1cbbc10fbbd4502bb8e3c06..fcec467d7f442e8cd22417122fbf98769a8d99c3 100644 (file)
@@ -119,7 +119,7 @@ public class LinesAction implements SourcesWsAction {
       int from = request.mandatoryParamAsInt(PARAM_FROM);
       int to = MoreObjects.firstNonNull(request.paramAsInt(PARAM_TO), Integer.MAX_VALUE);
 
-      Iterable<DbFileSources.Line> lines = checkFoundWithOptional(sourceService.getLines(dbSession, file.uuid(), from, to), "No source found for file '%s'", file.key());
+      Iterable<DbFileSources.Line> lines = checkFoundWithOptional(sourceService.getLines(dbSession, file.uuid(), from, to), "No source found for file '%s'", file.getDbKey());
       try (JsonWriter json = response.newJsonWriter()) {
         json.beginObject();
         writeSource(lines, json);
index 500c0fe7d49a17a4032dae227ebc75ab41cee3dd..693feadea7b08ccfd27e460e9dd71979ebf5d6e4 100644 (file)
@@ -66,7 +66,7 @@ public class DisplayLogOnDeprecatedProjects implements Startable {
           LOG.warn("We detected that the following projects have not been analysed on a SonarQube version greater than 4.2 (included):");
           hasDetectDeprecatedProjects = true;
         }
-        LOG.warn(" - {}", project.getKey());
+        LOG.warn(" - {}", project.getDbKey());
       }
     }
     if (hasDetectDeprecatedProjects) {
index 59e0b451d7592812a91c13e99eb36bb33dead2fa..61bfd1aaeaff883aa66cb0622daa06553ce71edc 100644 (file)
@@ -91,7 +91,7 @@ public class CoveredFilesAction implements TestsWsAction {
         fileBuilder.setCoveredLines(doc.coveredLines().size());
         ComponentDto component = componentsByUuid.get(doc.fileUuid());
         if (component != null) {
-          fileBuilder.setKey(component.key());
+          fileBuilder.setKey(component.getDbKey());
           fileBuilder.setLongName(component.longName());
         }
 
index 1a54f3efa379fe36fecf10b5d6c5b9caca0dc16b..c323b1c1b5addedcdf8d9665f4ba84bc77e8143c 100644 (file)
@@ -158,7 +158,7 @@ public class ListAction implements TestsWsAction {
       testBuilder.setFileId(testDoc.fileUuid());
       ComponentDto component = componentsByTestFileUuid.get(testDoc.fileUuid());
       if (component != null) {
-        testBuilder.setFileKey(component.getKey());
+        testBuilder.setFileKey(component.getDbKey());
         testBuilder.setFileName(component.longName());
       }
       testBuilder.setStatus(WsTests.TestStatus.valueOf(testDoc.status()));
index 9d8a938cc9ee4fa45e0403ca6a54cd40c8326c8a..bf5b9654495f8ae9b0129814911cdf0aaf8f80a4 100644 (file)
@@ -169,7 +169,7 @@ public class ComponentAction implements NavigationWsAction {
   }
 
   private void writeComponent(JsonWriter json, DbSession session, ComponentDto component, OrganizationDto organizationDto, @Nullable SnapshotDto analysis) {
-    json.prop("key", component.key())
+    json.prop("key", component.getDbKey())
       .prop("organization", organizationDto.getKey())
       .prop("id", component.uuid())
       .prop("name", component.name())
@@ -281,7 +281,7 @@ public class ComponentAction implements NavigationWsAction {
 
     for (ComponentDto c : breadcrumb) {
       json.beginObject()
-        .prop("key", c.key())
+        .prop("key", c.getDbKey())
         .prop("name", c.name())
         .prop("qualifier", c.qualifier())
         .endObject();
index 198d9e1f41a27d2b9c8407845bdcffccfc657828..ed21bffdffe2237e049af74d1a46d9c028c4a0c6 100644 (file)
@@ -40,7 +40,7 @@ class WebhookWsSupport {
       .setUrl(dto.getUrl())
       .setSuccess(dto.isSuccess())
       .setCeTaskId(dto.getCeTaskUuid())
-      .setComponentKey(component.getKey());
+      .setComponentKey(component.getDbKey());
     if (dto.getHttpStatus() != null) {
       builder.setHttpStatus(dto.getHttpStatus());
     }
index 71829dfd15758bd89ae211c91a088f822af40ff8..8109a82d442d8dc7f5dfdd8176ba11f14bcb976c 100644 (file)
@@ -195,7 +195,7 @@ public class CeQueueImplTest {
       assertThat(task.getComponentKey()).isNull();
       assertThat(task.getComponentName()).isNull();
     } else {
-      assertThat(task.getComponentKey()).isEqualTo(componentDto.key());
+      assertThat(task.getComponentKey()).isEqualTo(componentDto.getDbKey());
       assertThat(task.getComponentName()).isEqualTo(componentDto.name());
     }
     assertThat(task.getSubmitterLogin()).isEqualTo(taskSubmit.getSubmitterLogin());
index b3d9f40c40827c2c66ae74b88077b02d41f6ac25..d60c60980ac98f655806bd98b9ac6896edf5073f 100644 (file)
@@ -81,10 +81,10 @@ public class IssuesActionTest {
         .setAssignee(null));
     addPermissionTo(project);
 
-    ServerIssue serverIssue = call(project.key());
+    ServerIssue serverIssue = call(project.getDbKey());
 
     assertThat(serverIssue.getKey()).isEqualTo(issue.getKey());
-    assertThat(serverIssue.getModuleKey()).isEqualTo(module.getKey());
+    assertThat(serverIssue.getModuleKey()).isEqualTo(module.getDbKey());
     assertThat(serverIssue.getRuleRepository()).isEqualTo(rule.getRepositoryKey());
     assertThat(serverIssue.getRuleKey()).isEqualTo(rule.getRuleKey());
     assertThat(serverIssue.getStatus()).isEqualTo("OPEN");
@@ -118,10 +118,10 @@ public class IssuesActionTest {
         .setAssignee("foo"));
     addPermissionTo(project);
 
-    ServerIssue serverIssue = call(project.key());
+    ServerIssue serverIssue = call(project.getDbKey());
 
     assertThat(serverIssue.getKey()).isEqualTo(issue.getKey());
-    assertThat(serverIssue.getModuleKey()).isEqualTo(module.getKey());
+    assertThat(serverIssue.getModuleKey()).isEqualTo(module.getDbKey());
     assertThat(serverIssue.getRuleRepository()).isEqualTo(rule.getRepositoryKey());
     assertThat(serverIssue.getRuleKey()).isEqualTo(rule.getRuleKey());
     assertThat(serverIssue.getStatus()).isEqualTo("OPEN");
@@ -147,13 +147,13 @@ public class IssuesActionTest {
     IssueDto issueOnProject = db.issues().insert(rule, project, project, i -> i.setKee("ON_PROJECT"));
 
     addPermissionTo(project);
-    try (CloseableIterator<ServerIssue> result = callStream(project.key())) {
+    try (CloseableIterator<ServerIssue> result = callStream(project.getDbKey())) {
       assertThat(result)
         .extracting(ServerIssue::getKey, ServerIssue::getModuleKey)
         .containsExactlyInAnyOrder(
-          tuple(issueOnFile.getKey(), module.key()),
-          tuple(issueOnModule.getKey(), module.key()),
-          tuple(issueOnProject.getKey(), project.key()));
+          tuple(issueOnFile.getKey(), module.getDbKey()),
+          tuple(issueOnModule.getKey(), module.getDbKey()),
+          tuple(issueOnProject.getKey(), project.getDbKey()));
     }
   }
 
@@ -168,12 +168,12 @@ public class IssuesActionTest {
     IssueDto issueOnProject = db.issues().insert(rule, project, project, i -> i.setKee("ON_PROJECT"));
 
     addPermissionTo(project);
-    try (CloseableIterator<ServerIssue> result = callStream(module.key())) {
+    try (CloseableIterator<ServerIssue> result = callStream(module.getDbKey())) {
       assertThat(result)
         .extracting(ServerIssue::getKey, ServerIssue::getModuleKey)
         .containsExactlyInAnyOrder(
-          tuple(issueOnFile.getKey(), module.key()),
-          tuple(issueOnModule.getKey(), module.key()));
+          tuple(issueOnFile.getKey(), module.getDbKey()),
+          tuple(issueOnModule.getKey(), module.getDbKey()));
     }
   }
 
@@ -188,11 +188,11 @@ public class IssuesActionTest {
     IssueDto issueOnProject = db.issues().insert(rule, project, project);
 
     addPermissionTo(project);
-    try (CloseableIterator<ServerIssue> result = callStream(file.key())) {
+    try (CloseableIterator<ServerIssue> result = callStream(file.getDbKey())) {
       assertThat(result)
         .extracting(ServerIssue::getKey, ServerIssue::getModuleKey)
         .containsExactlyInAnyOrder(
-          tuple(issueOnFile.getKey(), module.key()));
+          tuple(issueOnFile.getKey(), module.getDbKey()));
     }
   }
 
@@ -205,7 +205,7 @@ public class IssuesActionTest {
     expectedException.expect(IllegalArgumentException.class);
     expectedException.expectMessage("Component of scope 'DIR' is not allowed");
 
-    call(directory.key());
+    call(directory.getDbKey());
   }
 
   @Test
@@ -217,11 +217,11 @@ public class IssuesActionTest {
     IssueDto issue = db.issues().insert(rule, project, file);
 
     addPermissionTo(project);
-    try (CloseableIterator<ServerIssue> result = callStream(project.key())) {
+    try (CloseableIterator<ServerIssue> result = callStream(project.getDbKey())) {
       // Module key of removed file should be returned
       assertThat(result)
         .extracting(ServerIssue::getKey, ServerIssue::getModuleKey)
-        .containsExactly(tuple(issue.getKey(), module.key()));
+        .containsExactly(tuple(issue.getKey(), module.getDbKey()));
     }
   }
 
@@ -232,7 +232,7 @@ public class IssuesActionTest {
 
     expectedException.expect(ForbiddenException.class);
 
-    tester.newRequest().setParam("key", file.key()).execute();
+    tester.newRequest().setParam("key", file.getDbKey()).execute();
   }
 
   @Test
index f9dc210ac5f7f493b64bce347aab668f6db38d63..6a97daedce4eea8f3e86ad362a34f5ace3c8f363 100644 (file)
@@ -100,9 +100,9 @@ public class ProjectDataLoaderMediumTest {
       dbSession, new PropertyDto().setKey("sonar.jira.login.secured").setValue("john").setResourceId(project.getId()));
     dbSession.commit();
 
-    ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(project.key()));
+    ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(project.getDbKey()));
 
-    Map<String, String> projectSettings = ref.settings(project.key());
+    Map<String, String> projectSettings = ref.settings(project.getDbKey());
     assertThat(projectSettings).isEqualTo(ImmutableMap.of(
       "sonar.jira.project.key", "SONAR",
       "sonar.jira.login.secured", "john"));
@@ -124,9 +124,9 @@ public class ProjectDataLoaderMediumTest {
       dbSession, new PropertyDto().setKey("sonar.jira.login.secured").setValue("john").setResourceId(project.getId()));
     dbSession.commit();
 
-    ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(project.key()));
+    ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(project.getDbKey()));
 
-    Map<String, String> projectSettings = ref.settings(project.key());
+    Map<String, String> projectSettings = ref.settings(project.getDbKey());
     assertThat(projectSettings).isEqualTo(ImmutableMap.of(
       "sonar.jira.project.key", "SONAR",
       "sonar.jira.login.secured", "john"));
@@ -148,8 +148,8 @@ public class ProjectDataLoaderMediumTest {
       dbSession, new PropertyDto().setKey("sonar.jira.login.secured").setValue("john").setResourceId(project.getId()));
     dbSession.commit();
 
-    ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(project.key()).setIssuesMode(true));
-    Map<String, String> projectSettings = ref.settings(project.key());
+    ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(project.getDbKey()).setIssuesMode(true));
+    Map<String, String> projectSettings = ref.settings(project.getDbKey());
     assertThat(projectSettings).isEqualTo(ImmutableMap.of(
       "sonar.jira.project.key", "SONAR"));
   }
@@ -180,11 +180,11 @@ public class ProjectDataLoaderMediumTest {
 
     dbSession.commit();
 
-    ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(project.key()));
-    assertThat(ref.settings(project.key())).isEqualTo(ImmutableMap.of(
+    ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(project.getDbKey()));
+    assertThat(ref.settings(project.getDbKey())).isEqualTo(ImmutableMap.of(
       "sonar.jira.project.key", "SONAR",
       "sonar.jira.login.secured", "john"));
-    assertThat(ref.settings(module.key())).isEqualTo(ImmutableMap.of(
+    assertThat(ref.settings(module.getDbKey())).isEqualTo(ImmutableMap.of(
       "sonar.jira.project.key", "SONAR-SERVER",
       "sonar.jira.login.secured", "john",
       "sonar.coverage.exclusions", "**/*.java"));
@@ -212,11 +212,11 @@ public class ProjectDataLoaderMediumTest {
 
     dbSession.commit();
 
-    ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(project.key()));
-    assertThat(ref.settings(project.key())).isEqualTo(ImmutableMap.of(
+    ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(project.getDbKey()));
+    assertThat(ref.settings(project.getDbKey())).isEqualTo(ImmutableMap.of(
       "sonar.jira.project.key", "SONAR",
       "sonar.jira.login.secured", "john"));
-    assertThat(ref.settings(module.key())).isEqualTo(ImmutableMap.of(
+    assertThat(ref.settings(module.getDbKey())).isEqualTo(ImmutableMap.of(
       "sonar.jira.project.key", "SONAR",
       "sonar.jira.login.secured", "john"));
   }
@@ -254,15 +254,15 @@ public class ProjectDataLoaderMediumTest {
 
     dbSession.commit();
 
-    ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(project.key()));
-    assertThat(ref.settings(project.key())).isEqualTo(ImmutableMap.of(
+    ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(project.getDbKey()));
+    assertThat(ref.settings(project.getDbKey())).isEqualTo(ImmutableMap.of(
       "sonar.jira.project.key", "SONAR",
       "sonar.jira.login.secured", "john"));
-    assertThat(ref.settings(module.key())).isEqualTo(ImmutableMap.of(
+    assertThat(ref.settings(module.getDbKey())).isEqualTo(ImmutableMap.of(
       "sonar.jira.project.key", "SONAR-SERVER",
       "sonar.jira.login.secured", "john",
       "sonar.coverage.exclusions", "**/*.java"));
-    assertThat(ref.settings(subModule.key())).isEqualTo(ImmutableMap.of(
+    assertThat(ref.settings(subModule.getDbKey())).isEqualTo(ImmutableMap.of(
       "sonar.jira.project.key", "SONAR-SERVER-DAO",
       "sonar.jira.login.secured", "john",
       "sonar.coverage.exclusions", "**/*.java"));
@@ -300,15 +300,15 @@ public class ProjectDataLoaderMediumTest {
 
     dbSession.commit();
 
-    ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(project.key()));
-    assertThat(ref.settings(project.key())).isEqualTo(ImmutableMap.of(
+    ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(project.getDbKey()));
+    assertThat(ref.settings(project.getDbKey())).isEqualTo(ImmutableMap.of(
       "sonar.jira.project.key", "SONAR",
       "sonar.jira.login.secured", "john"));
-    assertThat(ref.settings(module1.key())).isEqualTo(ImmutableMap.of(
+    assertThat(ref.settings(module1.getDbKey())).isEqualTo(ImmutableMap.of(
       "sonar.jira.project.key", "SONAR-SERVER",
       "sonar.jira.login.secured", "john",
       "sonar.coverage.exclusions", "**/*.java"));
-    assertThat(ref.settings(module2.key())).isEqualTo(ImmutableMap.of(
+    assertThat(ref.settings(module2.getDbKey())).isEqualTo(ImmutableMap.of(
       "sonar.jira.project.key", "SONAR-APPLICATION",
       "sonar.jira.login.secured", "john"));
   }
@@ -329,8 +329,8 @@ public class ProjectDataLoaderMediumTest {
 
     dbSession.commit();
 
-    ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(project.key()));
-    assertThat(ref.settings(project.key())).isEqualTo(ImmutableMap.of(
+    ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(project.getDbKey()));
+    assertThat(ref.settings(project.getDbKey())).isEqualTo(ImmutableMap.of(
       "sonar.jira.project.key", "SONAR",
       "sonar.jira.login.secured", "john"));
   }
@@ -360,10 +360,10 @@ public class ProjectDataLoaderMediumTest {
 
     dbSession.commit();
 
-    ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(subModule.key()));
-    assertThat(ref.settings(project.key())).isEmpty();
-    assertThat(ref.settings(module.key())).isEmpty();
-    assertThat(ref.settings(subModule.key())).isEqualTo(ImmutableMap.of(
+    ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(subModule.getDbKey()));
+    assertThat(ref.settings(project.getDbKey())).isEmpty();
+    assertThat(ref.settings(module.getDbKey())).isEmpty();
+    assertThat(ref.settings(subModule.getDbKey())).isEqualTo(ImmutableMap.of(
       "sonar.jira.project.key", "SONAR",
       "sonar.jira.login.secured", "john",
       "sonar.coverage.exclusions", "**/*.java"));
@@ -396,10 +396,10 @@ public class ProjectDataLoaderMediumTest {
 
     dbSession.commit();
 
-    ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(subModule.key()));
-    assertThat(ref.settings(project.key())).isEmpty();
-    assertThat(ref.settings(module.key())).isEmpty();
-    assertThat(ref.settings(subModule.key())).isEqualTo(ImmutableMap.of(
+    ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(subModule.getDbKey()));
+    assertThat(ref.settings(project.getDbKey())).isEmpty();
+    assertThat(ref.settings(module.getDbKey())).isEmpty();
+    assertThat(ref.settings(subModule.getDbKey())).isEqualTo(ImmutableMap.of(
       "sonar.jira.project.key", "SONAR",
       "sonar.jira.login.secured", "john",
       "sonar.coverage.exclusions", "**/*.java"));
@@ -430,10 +430,10 @@ public class ProjectDataLoaderMediumTest {
 
     dbSession.commit();
 
-    ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(subModule.key()));
-    assertThat(ref.settings(project.key())).isEmpty();
-    assertThat(ref.settings(module.key())).isEmpty();
-    assertThat(ref.settings(subModule.key())).isEqualTo(ImmutableMap.of(
+    ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(subModule.getDbKey()));
+    assertThat(ref.settings(project.getDbKey())).isEmpty();
+    assertThat(ref.settings(module.getDbKey())).isEmpty();
+    assertThat(ref.settings(subModule.getDbKey())).isEqualTo(ImmutableMap.of(
       "sonar.jira.project.key", "SONAR",
       "sonar.jira.login.secured", "john",
       "sonar.coverage.exclusions", "**/*.java"));
@@ -465,10 +465,10 @@ public class ProjectDataLoaderMediumTest {
 
     dbSession.commit();
 
-    ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(subModule.key()));
-    assertThat(ref.settings(project.key())).isEmpty();
-    assertThat(ref.settings(module.key())).isEmpty();
-    assertThat(ref.settings(subModule.key())).isEqualTo(ImmutableMap.of(
+    ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(subModule.getDbKey()));
+    assertThat(ref.settings(project.getDbKey())).isEmpty();
+    assertThat(ref.settings(module.getDbKey())).isEmpty();
+    assertThat(ref.settings(subModule.getDbKey())).isEqualTo(ImmutableMap.of(
       "sonar.jira.project.key", "SONAR-SERVER",
       "sonar.jira.login.secured", "john",
       "sonar.coverage.exclusions", "**/*.java"));
@@ -485,7 +485,7 @@ public class ProjectDataLoaderMediumTest {
     dbSession.commit();
 
     try {
-      underTest.load(ProjectDataQuery.create().setModuleKey(project.key()));
+      underTest.load(ProjectDataQuery.create().setModuleKey(project.getDbKey()));
       fail();
     } catch (Exception e) {
       assertThat(e).isInstanceOf(ForbiddenException.class).hasMessage(Messages.NO_PERMISSION);
@@ -505,7 +505,7 @@ public class ProjectDataLoaderMediumTest {
     thrown.expect(ForbiddenException.class);
     thrown.expectMessage("You're only authorized to execute a local (preview) SonarQube analysis without pushing the results to the SonarQube server. " +
       "Please contact your SonarQube administrator.");
-    underTest.load(ProjectDataQuery.create().setModuleKey(project.key()).setIssuesMode(false));
+    underTest.load(ProjectDataQuery.create().setModuleKey(project.getDbKey()).setIssuesMode(false));
   }
 
   @Test
@@ -520,7 +520,7 @@ public class ProjectDataLoaderMediumTest {
 
     thrown.expect(ForbiddenException.class);
     thrown.expectMessage("You don't have the required permissions to access this project. Please contact your SonarQube administrator.");
-    underTest.load(ProjectDataQuery.create().setModuleKey(project.key()).setIssuesMode(true));
+    underTest.load(ProjectDataQuery.create().setModuleKey(project.getDbKey()).setIssuesMode(true));
   }
 
   @Test
@@ -537,9 +537,9 @@ public class ProjectDataLoaderMediumTest {
     tester.get(FileSourceDao.class).insert(dbSession, newFileSourceDto(file).setSrcHash("123456"));
     dbSession.commit();
 
-    ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(project.key()));
-    assertThat(ref.fileDataByPath(project.key())).hasSize(1);
-    FileData fileData = ref.fileData(project.key(), file.path());
+    ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(project.getDbKey()));
+    assertThat(ref.fileDataByPath(project.getDbKey())).hasSize(1);
+    FileData fileData = ref.fileData(project.getDbKey(), file.path());
     assertThat(fileData.hash()).isEqualTo("123456");
   }
 
@@ -567,9 +567,9 @@ public class ProjectDataLoaderMediumTest {
 
     dbSession.commit();
 
-    ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(project.key()));
-    assertThat(ref.fileData(project.key(), projectFile.path()).hash()).isEqualTo("123456");
-    assertThat(ref.fileData(module.key(), moduleFile.path()).hash()).isEqualTo("789456");
+    ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(project.getDbKey()));
+    assertThat(ref.fileData(project.getDbKey(), projectFile.path()).hash()).isEqualTo("123456");
+    assertThat(ref.fileData(module.getDbKey(), moduleFile.path()).hash()).isEqualTo("789456");
   }
 
   @Test
@@ -596,10 +596,10 @@ public class ProjectDataLoaderMediumTest {
 
     dbSession.commit();
 
-    ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(module.key()));
-    assertThat(ref.fileData(module.key(), moduleFile.path()).hash()).isEqualTo("789456");
-    assertThat(ref.fileData(module.key(), moduleFile.path()).revision()).isEqualTo("123456789");
-    assertThat(ref.fileData(project.key(), projectFile.path())).isNull();
+    ProjectRepositories ref = underTest.load(ProjectDataQuery.create().setModuleKey(module.getDbKey()));
+    assertThat(ref.fileData(module.getDbKey(), moduleFile.path()).hash()).isEqualTo("789456");
+    assertThat(ref.fileData(module.getDbKey(), moduleFile.path()).revision()).isEqualTo("123456789");
+    assertThat(ref.fileData(project.getDbKey(), projectFile.path())).isNull();
   }
 
   private void addDefaultProfile() {
index b15d105343959d835855b0792f308236153ffd22..9b3e6580231d082ce06806876a643ad4af4e3b7d 100644 (file)
@@ -116,7 +116,7 @@ public class ProjectDataLoaderTest {
         .setProjectUuid(uuid)
         .setScope(scope)
         .setQualifier(qualifier)
-        .setKey(key));
+        .setDbKey(key));
       dbSession.commit();
 
       try {
@@ -136,7 +136,7 @@ public class ProjectDataLoaderTest {
     expectedException.expect(ForbiddenException.class);
     expectedException.expectMessage("You're not authorized to execute any SonarQube analysis");
 
-    underTest.load(ProjectDataQuery.create().setModuleKey(project.key()));
+    underTest.load(ProjectDataQuery.create().setModuleKey(project.getDbKey()));
   }
 
   @Test
@@ -147,7 +147,7 @@ public class ProjectDataLoaderTest {
     expectedException.expect(ForbiddenException.class);
     expectedException.expectMessage("You're only authorized to execute a local (preview) SonarQube analysis without pushing the results to the SonarQube server");
 
-    underTest.load(ProjectDataQuery.create().setModuleKey(project.key()));
+    underTest.load(ProjectDataQuery.create().setModuleKey(project.getDbKey()));
   }
 
   @Test
@@ -155,7 +155,7 @@ public class ProjectDataLoaderTest {
     ComponentDto project = dbTester.components().insertPrivateProject();
     userSession.logIn().addProjectPermission(UserRole.USER, project);
 
-    ProjectRepositories repositories = underTest.load(ProjectDataQuery.create().setModuleKey(project.key()).setIssuesMode(true));
+    ProjectRepositories repositories = underTest.load(ProjectDataQuery.create().setModuleKey(project.getDbKey()).setIssuesMode(true));
 
     assertThat(repositories).isNotNull();
   }
@@ -168,7 +168,7 @@ public class ProjectDataLoaderTest {
     expectedException.expect(ForbiddenException.class);
     expectedException.expectMessage("You don't have the required permissions to access this project");
 
-    underTest.load(ProjectDataQuery.create().setModuleKey(project.key()).setIssuesMode(true));
+    underTest.load(ProjectDataQuery.create().setModuleKey(project.getDbKey()).setIssuesMode(true));
   }
 
   @Test
@@ -177,7 +177,7 @@ public class ProjectDataLoaderTest {
     userSession.logIn().addPermission(SCAN, project.getOrganizationUuid());
     userSession.logIn().addProjectPermission(UserRole.USER, project);
 
-    ProjectRepositories repositories = underTest.load(ProjectDataQuery.create().setModuleKey(project.key()).setIssuesMode(true));
+    ProjectRepositories repositories = underTest.load(ProjectDataQuery.create().setModuleKey(project.getDbKey()).setIssuesMode(true));
 
     assertThat(repositories).isNotNull();
   }
index c959131069ec7f94786a5c00c04924a1183e6697..979c171c1d240b33d59e751a0cded4980220c255 100644 (file)
@@ -120,7 +120,7 @@ public class ActivityStatusActionTest {
     db.components().insertComponent(project);
     expectedException.expect(IllegalArgumentException.class);
 
-    callByComponentUuidOrComponentKey(project.uuid(), project.key());
+    callByComponentUuidOrComponentKey(project.uuid(), project.getDbKey());
   }
 
   @Test
@@ -155,7 +155,7 @@ public class ActivityStatusActionTest {
     expectedException.expect(ForbiddenException.class);
     expectedException.expectMessage("Insufficient privileges");
 
-    callByComponentKey(project.key());
+    callByComponentKey(project.getDbKey());
   }
 
   private void insertInQueue(CeQueueDto.Status status, @Nullable String componentUuid) {
index e25a4138a3d435d40d6f9b59bf8d7fc078bf641b..1da27f81fb3afbc2b883eec019733495d021e27c 100644 (file)
@@ -102,7 +102,7 @@ public class ComponentActionTest {
     insertActivity("T1", project.uuid(), CeActivityDto.Status.SUCCESS);
 
     WsCe.ProjectResponse response = ws.newRequest()
-      .setParam(PARAM_COMPONENT_KEY, project.key())
+      .setParam(PARAM_COMPONENT_KEY, project.getDbKey())
       .executeProtobuf(WsCe.ProjectResponse.class);
     assertThat(response.hasCurrent()).isTrue();
   }
index 2978499f5d0ee78cb55a24ebf29da4438d24f965..6415597b482fd3d664b76c65c90ecbbad2d78e61 100644 (file)
@@ -88,7 +88,7 @@ public class TaskActionTest {
     assertThat(taskResponse.getTask().getStatus()).isEqualTo(WsCe.TaskStatus.PENDING);
     assertThat(taskResponse.getTask().getSubmitterLogin()).isEqualTo("john");
     assertThat(taskResponse.getTask().getComponentId()).isEqualTo(project.uuid());
-    assertThat(taskResponse.getTask().getComponentKey()).isEqualTo(project.key());
+    assertThat(taskResponse.getTask().getComponentKey()).isEqualTo(project.getDbKey());
     assertThat(taskResponse.getTask().getComponentName()).isEqualTo(project.name());
     assertThat(taskResponse.getTask().hasExecutionTimeMs()).isFalse();
     assertThat(taskResponse.getTask().getLogs()).isFalse();
@@ -109,7 +109,7 @@ public class TaskActionTest {
     assertThat(task.getId()).isEqualTo(SOME_TASK_UUID);
     assertThat(task.getStatus()).isEqualTo(WsCe.TaskStatus.FAILED);
     assertThat(task.getComponentId()).isEqualTo(project.uuid());
-    assertThat(task.getComponentKey()).isEqualTo(project.key());
+    assertThat(task.getComponentKey()).isEqualTo(project.getDbKey());
     assertThat(task.getComponentName()).isEqualTo(project.name());
     assertThat(task.getAnalysisId()).isEqualTo(activityDto.getAnalysisUuid());
     assertThat(task.getExecutionTimeMs()).isEqualTo(500L);
index 9edfea2cfd7597e3858ef97828ab7ae2be78dd87..3e99deaa3939865a01f879d92236d7b6aa29b08b 100644 (file)
@@ -78,7 +78,7 @@ public class TaskFormatterTest {
   public void formatQueue_with_component_and_other_fields() throws IOException {
     String uuid = "COMPONENT_UUID";
     OrganizationDto organizationDto = db.organizations().insert();
-    db.components().insertPrivateProject(organizationDto, (t) -> t.setUuid(uuid).setKey("COMPONENT_KEY").setName("Component Name"));
+    db.components().insertPrivateProject(organizationDto, (t) -> t.setUuid(uuid).setDbKey("COMPONENT_KEY").setName("Component Name"));
 
     CeQueueDto dto = new CeQueueDto();
     dto.setUuid("UUID");
index 1a53c05b7edff923d1833efbc5614009fa7098f8..6e390230fe2385fbb76d070819aec210403ff7ca 100644 (file)
@@ -130,7 +130,7 @@ public class ComponentCleanerServiceTest {
   private DbData insertData(int id) {
     String suffix = String.valueOf(id);
     ComponentDto project = newPrivateProjectDto(db.organizations().insert(), "project-uuid-" + suffix)
-      .setKey("project-key-" + suffix);
+      .setDbKey("project-key-" + suffix);
     RuleDefinitionDto rule = RuleTesting.newRule(RuleKey.of("sonarqube", "rule-" + suffix));
     dbClient.ruleDao().insert(dbSession, rule);
     IssueDto issue = IssueTesting.newIssue(rule, project, project).setKee("issue-key-" + suffix).setUpdatedAt(new Date().getTime());
index 28206241106b56951c6d650ceb306c383d0dfca9..fcccc22fb603219b7fac8d408bd2eb179efbdd40 100644 (file)
@@ -106,7 +106,7 @@ public class ComponentFinderTest {
   @Test
   public void fail_when_component_key_is_removed() {
     ComponentDto project = db.components().insertComponent(newPrivateProjectDto(db.getDefaultOrganization()));
-    db.components().insertComponent(newFileDto(project).setKey("file-key").setEnabled(false));
+    db.components().insertComponent(newFileDto(project).setDbKey("file-key").setEnabled(false));
 
 
     expectedException.expect(NotFoundException.class);
@@ -126,10 +126,10 @@ public class ComponentFinderTest {
 
   @Test
   public void get_component_by_key() {
-    db.components().insertComponent(newPrivateProjectDto(db.getDefaultOrganization()).setKey("project-key"));
+    db.components().insertComponent(newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("project-key"));
 
     ComponentDto component = underTest.getByUuidOrKey(dbSession, null, "project-key", ID_AND_KEY);
 
-    assertThat(component.key()).isEqualTo("project-key");
+    assertThat(component.getDbKey()).isEqualTo("project-key");
   }
 }
index 7e63c6ec8731eba27e25118a9a4f58a58bf45d09..7221f1e079c1da7ac62c5e1411491896a8d4aad0 100644 (file)
@@ -54,19 +54,19 @@ public class ComponentServiceTest {
 
   @Test
   public void bulk_update() {
-    ComponentDto project = componentDb.insertComponent(ComponentTesting.newPrivateProjectDto(dbTester.organizations().insert()).setKey("my_project"));
-    ComponentDto module = componentDb.insertComponent(newModuleDto(project).setKey("my_project:root:module"));
-    ComponentDto inactiveModule = componentDb.insertComponent(newModuleDto(project).setKey("my_project:root:inactive_module").setEnabled(false));
-    ComponentDto file = componentDb.insertComponent(newFileDto(module, null).setKey("my_project:root:module:src/File.xoo"));
-    ComponentDto inactiveFile = componentDb.insertComponent(newFileDto(module, null).setKey("my_project:root:module:src/InactiveFile.xoo").setEnabled(false));
+    ComponentDto project = componentDb.insertComponent(ComponentTesting.newPrivateProjectDto(dbTester.organizations().insert()).setDbKey("my_project"));
+    ComponentDto module = componentDb.insertComponent(newModuleDto(project).setDbKey("my_project:root:module"));
+    ComponentDto inactiveModule = componentDb.insertComponent(newModuleDto(project).setDbKey("my_project:root:inactive_module").setEnabled(false));
+    ComponentDto file = componentDb.insertComponent(newFileDto(module, null).setDbKey("my_project:root:module:src/File.xoo"));
+    ComponentDto inactiveFile = componentDb.insertComponent(newFileDto(module, null).setDbKey("my_project:root:module:src/InactiveFile.xoo").setEnabled(false));
 
     underTest.bulkUpdateKey(dbSession, project, "my_", "your_");
 
-    assertComponentKeyUpdated(project.key(), "your_project");
-    assertComponentKeyUpdated(module.key(), "your_project:root:module");
-    assertComponentKeyUpdated(file.key(), "your_project:root:module:src/File.xoo");
-    assertComponentKeyNotUpdated(inactiveModule.key());
-    assertComponentKeyNotUpdated(inactiveFile.key());
+    assertComponentKeyUpdated(project.getDbKey(), "your_project");
+    assertComponentKeyUpdated(module.getDbKey(), "your_project:root:module");
+    assertComponentKeyUpdated(file.getDbKey(), "your_project:root:module:src/File.xoo");
+    assertComponentKeyNotUpdated(inactiveModule.getDbKey());
+    assertComponentKeyNotUpdated(inactiveFile.getDbKey());
   }
 
   private void assertComponentKeyUpdated(String oldKey, String newKey) {
index 22334b55a5895d6baa7dbe22c0cfaeddd75cfedb..fa3327ea4c2c652e22173fdb73775695383753e1 100644 (file)
@@ -60,8 +60,8 @@ public class ComponentServiceUpdateKeyTest {
   @Test
   public void update_project_key() {
     ComponentDto project = insertSampleRootProject();
-    ComponentDto file = componentDb.insertComponent(ComponentTesting.newFileDto(project, null).setKey("sample:root:src/File.xoo"));
-    ComponentDto inactiveFile = componentDb.insertComponent(ComponentTesting.newFileDto(project, null).setKey("sample:root:src/InactiveFile.xoo").setEnabled(false));
+    ComponentDto file = componentDb.insertComponent(ComponentTesting.newFileDto(project, null).setDbKey("sample:root:src/File.xoo"));
+    ComponentDto inactiveFile = componentDb.insertComponent(ComponentTesting.newFileDto(project, null).setDbKey("sample:root:src/InactiveFile.xoo").setEnabled(false));
 
     dbSession.commit();
 
@@ -70,14 +70,14 @@ public class ComponentServiceUpdateKeyTest {
     dbSession.commit();
 
     // Check project key has been updated
-    assertThat(db.getDbClient().componentDao().selectByKey(dbSession, project.key())).isAbsent();
+    assertThat(db.getDbClient().componentDao().selectByKey(dbSession, project.getDbKey())).isAbsent();
     assertThat(db.getDbClient().componentDao().selectByKey(dbSession, "sample2:root")).isNotNull();
 
     // Check file key has been updated
-    assertThat(db.getDbClient().componentDao().selectByKey(dbSession, file.key())).isAbsent();
+    assertThat(db.getDbClient().componentDao().selectByKey(dbSession, file.getDbKey())).isAbsent();
     assertThat(db.getDbClient().componentDao().selectByKey(dbSession, "sample2:root:src/File.xoo")).isNotNull();
 
-    assertThat(dbClient.componentDao().selectByKey(dbSession, inactiveFile.getKey())).isPresent();
+    assertThat(dbClient.componentDao().selectByKey(dbSession, inactiveFile.getDbKey())).isPresent();
 
     org.assertj.core.api.Assertions.assertThat(projectIndexers.hasBeenCalled(project.uuid(), ProjectIndexer.Cause.PROJECT_KEY_UPDATE)).isTrue();
   }
@@ -85,18 +85,18 @@ public class ComponentServiceUpdateKeyTest {
   @Test
   public void update_module_key() {
     ComponentDto project = insertSampleRootProject();
-    ComponentDto module = ComponentTesting.newModuleDto(project).setKey("sample:root:module");
+    ComponentDto module = ComponentTesting.newModuleDto(project).setDbKey("sample:root:module");
     db.components().insertComponent(module);
-    ComponentDto file = ComponentTesting.newFileDto(module, null).setKey("sample:root:module:src/File.xoo");
+    ComponentDto file = ComponentTesting.newFileDto(module, null).setDbKey("sample:root:module:src/File.xoo");
     db.components().insertComponent(file);
     logInAsProjectAdministrator(project);
 
     underTest.updateKey(dbSession, module, "sample:root2:module");
     dbSession.commit();
 
-    assertThat(dbClient.componentDao().selectByKey(dbSession, project.key())).isPresent();
-    assertComponentKeyHasBeenUpdated(module.key(), "sample:root2:module");
-    assertComponentKeyHasBeenUpdated(file.key(), "sample:root2:module:src/File.xoo");
+    assertThat(dbClient.componentDao().selectByKey(dbSession, project.getDbKey())).isPresent();
+    assertComponentKeyHasBeenUpdated(module.getDbKey(), "sample:root2:module");
+    assertComponentKeyHasBeenUpdated(file.getDbKey(), "sample:root2:module:src/File.xoo");
 
     // do not index the module but the project
     org.assertj.core.api.Assertions.assertThat(projectIndexers.hasBeenCalled(project.uuid(), ProjectIndexer.Cause.PROJECT_KEY_UPDATE)).isTrue();
@@ -112,7 +112,7 @@ public class ComponentServiceUpdateKeyTest {
     underTest.updateKey(dbSession, provisionedProject, "provisionedProject2");
     dbSession.commit();
 
-    assertComponentKeyHasBeenUpdated(provisionedProject.key(), "provisionedProject2");
+    assertComponentKeyHasBeenUpdated(provisionedProject.getDbKey(), "provisionedProject2");
     org.assertj.core.api.Assertions.assertThat(projectIndexers.hasBeenCalled(provisionedProject.uuid(), ProjectIndexer.Cause.PROJECT_KEY_UPDATE)).isTrue();
   }
 
@@ -133,9 +133,9 @@ public class ComponentServiceUpdateKeyTest {
     logInAsProjectAdministrator(project);
 
     expectedException.expect(IllegalArgumentException.class);
-    expectedException.expectMessage("Impossible to update key: a component with key \"" + anotherProject.key() + "\" already exists.");
+    expectedException.expectMessage("Impossible to update key: a component with key \"" + anotherProject.getDbKey() + "\" already exists.");
 
-    underTest.updateKey(dbSession, project, anotherProject.key());
+    underTest.updateKey(dbSession, project, anotherProject.getDbKey());
   }
 
   @Test
@@ -174,19 +174,19 @@ public class ComponentServiceUpdateKeyTest {
 
   @Test
   public void bulk_update_key() {
-    ComponentDto project = componentDb.insertComponent(ComponentTesting.newPrivateProjectDto(db.organizations().insert()).setKey("my_project"));
-    ComponentDto module = componentDb.insertComponent(newModuleDto(project).setKey("my_project:root:module"));
-    ComponentDto inactiveModule = componentDb.insertComponent(newModuleDto(project).setKey("my_project:root:inactive_module").setEnabled(false));
-    ComponentDto file = componentDb.insertComponent(newFileDto(module, null).setKey("my_project:root:module:src/File.xoo"));
-    ComponentDto inactiveFile = componentDb.insertComponent(newFileDto(module, null).setKey("my_project:root:module:src/InactiveFile.xoo").setEnabled(false));
+    ComponentDto project = componentDb.insertComponent(ComponentTesting.newPrivateProjectDto(db.organizations().insert()).setDbKey("my_project"));
+    ComponentDto module = componentDb.insertComponent(newModuleDto(project).setDbKey("my_project:root:module"));
+    ComponentDto inactiveModule = componentDb.insertComponent(newModuleDto(project).setDbKey("my_project:root:inactive_module").setEnabled(false));
+    ComponentDto file = componentDb.insertComponent(newFileDto(module, null).setDbKey("my_project:root:module:src/File.xoo"));
+    ComponentDto inactiveFile = componentDb.insertComponent(newFileDto(module, null).setDbKey("my_project:root:module:src/InactiveFile.xoo").setEnabled(false));
 
     underTest.bulkUpdateKey(dbSession, project, "my_", "your_");
 
-    assertComponentKeyUpdated(project.key(), "your_project");
-    assertComponentKeyUpdated(module.key(), "your_project:root:module");
-    assertComponentKeyUpdated(file.key(), "your_project:root:module:src/File.xoo");
-    assertComponentKeyNotUpdated(inactiveModule.key());
-    assertComponentKeyNotUpdated(inactiveFile.key());
+    assertComponentKeyUpdated(project.getDbKey(), "your_project");
+    assertComponentKeyUpdated(module.getDbKey(), "your_project:root:module");
+    assertComponentKeyUpdated(file.getDbKey(), "your_project:root:module:src/File.xoo");
+    assertComponentKeyNotUpdated(inactiveModule.getDbKey());
+    assertComponentKeyNotUpdated(inactiveFile.getDbKey());
   }
 
   private void assertComponentKeyUpdated(String oldKey, String newKey) {
@@ -203,7 +203,7 @@ public class ComponentServiceUpdateKeyTest {
   }
 
   private ComponentDto insertProject(String key) {
-    ComponentDto project = componentDb.insertComponent(ComponentTesting.newPrivateProjectDto(db.organizations().insert()).setKey(key));
+    ComponentDto project = componentDb.insertComponent(ComponentTesting.newPrivateProjectDto(db.organizations().insert()).setDbKey(key));
     return project;
   }
 
index d5d95abdbfae5f10adcb414fcbb15534d8526327..55f08fb1cc6582c56f904e88b1b212816d076906 100644 (file)
@@ -78,7 +78,7 @@ public class ComponentUpdaterTest {
     ComponentDto returned = underTest.create(db.getSession(), project, null);
 
     ComponentDto loaded = db.getDbClient().componentDao().selectOrFailByUuid(db.getSession(), returned.uuid());
-    assertThat(loaded.getKey()).isEqualTo(DEFAULT_PROJECT_KEY);
+    assertThat(loaded.getDbKey()).isEqualTo(DEFAULT_PROJECT_KEY);
     assertThat(loaded.deprecatedKey()).isEqualTo(DEFAULT_PROJECT_KEY);
     assertThat(loaded.name()).isEqualTo(DEFAULT_PROJECT_NAME);
     assertThat(loaded.longName()).isEqualTo(DEFAULT_PROJECT_NAME);
@@ -135,7 +135,7 @@ public class ComponentUpdaterTest {
         .build(),
       null);
 
-    assertThat(project.getKey()).isEqualTo("project-key:origin/master");
+    assertThat(project.getDbKey()).isEqualTo("project-key:origin/master");
   }
 
   @Test
@@ -150,7 +150,7 @@ public class ComponentUpdaterTest {
     ComponentDto returned = underTest.create(db.getSession(), view, null);
 
     ComponentDto loaded = db.getDbClient().componentDao().selectOrFailByUuid(db.getSession(), returned.uuid());
-    assertThat(loaded.getKey()).isEqualTo("view-key");
+    assertThat(loaded.getDbKey()).isEqualTo("view-key");
     assertThat(loaded.name()).isEqualTo("view-name");
     assertThat(loaded.qualifier()).isEqualTo("VW");
     assertThat(projectIndexers.hasBeenCalled(loaded.uuid(), ProjectIndexer.Cause.PROJECT_CREATION)).isTrue();
@@ -168,7 +168,7 @@ public class ComponentUpdaterTest {
     ComponentDto returned = underTest.create(db.getSession(), view, null);
 
     ComponentDto loaded = db.getDbClient().componentDao().selectOrFailByUuid(db.getSession(), returned.uuid());
-    assertThat(loaded.getKey()).isEqualTo("app-key");
+    assertThat(loaded.getDbKey()).isEqualTo("app-key");
     assertThat(loaded.name()).isEqualTo("app-name");
     assertThat(loaded.qualifier()).isEqualTo("APP");
     assertThat(projectIndexers.hasBeenCalled(loaded.uuid(), ProjectIndexer.Cause.PROJECT_CREATION)).isTrue();
@@ -185,8 +185,8 @@ public class ComponentUpdaterTest {
 
     ComponentDto returned = underTest.create(db.getSession(), view, null);
 
-    ComponentDto loaded = db.getDbClient().componentDao().selectByKey(db.getSession(), returned.key()).get();
-    assertThat(loaded.getKey()).isEqualTo("app-key");
+    ComponentDto loaded = db.getDbClient().componentDao().selectByKey(db.getSession(), returned.getDbKey()).get();
+    assertThat(loaded.getDbKey()).isEqualTo("app-key");
     assertThat(loaded.name()).isEqualTo("app-name");
     assertThat(loaded.qualifier()).isEqualTo("APP");
     assertThat(projectIndexers.hasBeenCalled(loaded.uuid(), ProjectIndexer.Cause.PROJECT_CREATION)).isTrue();
@@ -254,11 +254,11 @@ public class ComponentUpdaterTest {
     ComponentDto existing = db.components().insertPrivateProject();
 
     expectedException.expect(BadRequestException.class);
-    expectedException.expectMessage("Could not create Project, key already exists: " + existing.key());
+    expectedException.expectMessage("Could not create Project, key already exists: " + existing.getDbKey());
 
     underTest.create(db.getSession(),
       NewComponent.newComponentBuilder()
-        .setKey(existing.key())
+        .setKey(existing.getDbKey())
         .setName(DEFAULT_PROJECT_NAME)
         .setOrganizationUuid(existing.getOrganizationUuid())
         .build(),
@@ -270,11 +270,11 @@ public class ComponentUpdaterTest {
     ComponentDto existing = db.components().insertPrivateProject(db.organizations().insert());
 
     expectedException.expect(BadRequestException.class);
-    expectedException.expectMessage("Could not create Project, key already exists: " + existing.key());
+    expectedException.expectMessage("Could not create Project, key already exists: " + existing.getDbKey());
 
     underTest.create(db.getSession(),
       NewComponent.newComponentBuilder()
-        .setKey(existing.key())
+        .setKey(existing.getDbKey())
         .setName(DEFAULT_PROJECT_NAME)
         .setOrganizationUuid(existing.getOrganizationUuid())
         .build(),
index 1b88eda61ea915ba13d41f9ced38a5333ffdbe01..8e5156aad0c90c03dd98c83ba5b40e62cb5a8dde 100644 (file)
@@ -46,14 +46,14 @@ public class ComponentIndexFeatureFavoriteTest extends ComponentIndexTest {
     ComponentIndexQuery query1 = ComponentIndexQuery.builder()
       .setQuery("SonarQube")
       .setQualifiers(singletonList(PROJECT))
-      .setFavoriteKeys(of(project1.getKey()))
+      .setFavoriteKeys(of(project1.getDbKey()))
       .build();
     assertSearch(query1).containsExactly(uuids(project1, project2));
 
     ComponentIndexQuery query2 = ComponentIndexQuery.builder()
       .setQuery("SonarQube")
       .setQualifiers(singletonList(PROJECT))
-      .setFavoriteKeys(of(project2.getKey()))
+      .setFavoriteKeys(of(project2.getDbKey()))
       .build();
     assertSearch(query2).containsExactly(uuids(project2, project1));
   }
@@ -66,7 +66,7 @@ public class ComponentIndexFeatureFavoriteTest extends ComponentIndexTest {
     ComponentIndexQuery query1 = ComponentIndexQuery.builder()
       .setQuery("bar")
       .setQualifiers(singletonList(PROJECT))
-      .setFavoriteKeys(of(project1.getKey()))
+      .setFavoriteKeys(of(project1.getDbKey()))
       .build();
     assertSearch(query1).isEmpty();
   }
index c9d1a19e56e5ae35b5eda80d121c3a83628efd83..24158ff3296ad220abc7e1cc820f6671d9adf7b1 100644 (file)
@@ -45,14 +45,14 @@ public class ComponentIndexFeatureRecentlyBrowsedTest extends ComponentIndexTest
     ComponentIndexQuery query1 = ComponentIndexQuery.builder()
       .setQuery("SonarQube")
       .setQualifiers(Collections.singletonList(PROJECT))
-      .setRecentlyBrowsedKeys(of(project1.getKey()))
+      .setRecentlyBrowsedKeys(of(project1.getDbKey()))
       .build();
     assertSearch(query1).containsExactly(uuids(project1, project2));
 
     ComponentIndexQuery query2 = ComponentIndexQuery.builder()
       .setQuery("SonarQube")
       .setQualifiers(Collections.singletonList(PROJECT))
-      .setRecentlyBrowsedKeys(of(project2.getKey()))
+      .setRecentlyBrowsedKeys(of(project2.getDbKey()))
       .build();
     assertSearch(query2).containsExactly(uuids(project2, project1));
   }
index 4961047345438b115b020108637fd712cc188987..205917259cff7495f175e1adfb85a5554c5e6285 100644 (file)
@@ -121,15 +121,15 @@ public class ComponentIndexScoreTest extends ComponentIndexTest {
     assertSearch(ComponentIndexQuery.builder()
       .setQuery("File")
       .setQualifiers(asList(PROJECT, MODULE, FILE))
-      .setRecentlyBrowsedKeys(ImmutableSet.of(file1.getKey()))
-      .setFavoriteKeys(ImmutableSet.of(file2.getKey()))
+      .setRecentlyBrowsedKeys(ImmutableSet.of(file1.getDbKey()))
+      .setFavoriteKeys(ImmutableSet.of(file2.getDbKey()))
       .build()).containsExactly(uuids(file2, file1));
 
     assertSearch(ComponentIndexQuery.builder()
       .setQuery("File")
       .setQualifiers(asList(PROJECT, MODULE, FILE))
-      .setRecentlyBrowsedKeys(ImmutableSet.of(file2.getKey()))
-      .setFavoriteKeys(ImmutableSet.of(file1.getKey()))
+      .setRecentlyBrowsedKeys(ImmutableSet.of(file2.getDbKey()))
+      .setFavoriteKeys(ImmutableSet.of(file1.getDbKey()))
       .build()).containsExactly(uuids(file1, file2));
   }
 
@@ -160,12 +160,12 @@ public class ComponentIndexScoreTest extends ComponentIndexTest {
 
     index(ComponentTesting.newFileDto(project)
       .setName("DbTester.java")
-      .setKey("java/org/example/DbTester.java")
+      .setDbKey("java/org/example/DbTester.java")
       .setUuid("UUID-DbTester"));
 
     index(ComponentTesting.newFileDto(project)
       .setName("WebhookDbTesting.java")
-      .setKey("java/org/example/WebhookDbTesting.java")
+      .setDbKey("java/org/example/WebhookDbTesting.java")
       .setUuid("UUID-WebhookDbTesting"));
 
     assertSearch("dbt").containsExactly(
index 50f42cbf9821c7dd6147a41182df3920947babda..cabec1a8c2fa921f0bcbf1f5d574165e09f35be0 100644 (file)
@@ -126,13 +126,13 @@ public abstract class ComponentIndexTest {
   protected ComponentDto indexProject(String key, String name) {
     return index(
       ComponentTesting.newPrivateProjectDto(organization, "UUID_" + key)
-        .setKey(key)
+        .setDbKey(key)
         .setName(name));
   }
 
   protected ComponentDto newProject(String key, String name) {
     return ComponentTesting.newPrivateProjectDto(organization, "UUID_" + key)
-      .setKey(key)
+      .setDbKey(key)
       .setName(name);
   }
 
@@ -144,7 +144,7 @@ public abstract class ComponentIndexTest {
   protected ComponentDto indexFile(ComponentDto project, String fileKey, String fileName) {
     return index(
       ComponentTesting.newFileDto(project)
-        .setKey(fileKey)
+        .setDbKey(fileKey)
         .setName(fileName));
   }
 
index 619cd59f550414a628fd6d09bae9e6b7f81de8be..341e9d3a7380fdbcca66b88e96ef218f0b6cb999 100644 (file)
@@ -140,12 +140,12 @@ public class AppActionTest {
   private ComponentDto[] insertComponentsAndAnalysis() {
     ComponentDto project = ComponentTesting.newPrivateProjectDto(dbTester.getDefaultOrganization(), PROJECT_UUID)
       .setLongName("SonarQube")
-      .setKey(PROJECT_KEY);
+      .setDbKey(PROJECT_KEY);
     ComponentDto module = ComponentTesting.newModuleDto(MODULE_UUID, project)
       .setLongName("SonarQube :: Plugin API")
-      .setKey(MODULE_KEY);
+      .setDbKey(MODULE_KEY);
     ComponentDto file = ComponentTesting.newFileDto(module, null, FILE_UUID)
-      .setKey(FILE_KEY)
+      .setDbKey(FILE_KEY)
       .setName("Plugin.java")
       .setLongName("src/main/java/org/sonar/api/Plugin.java")
       .setPath("src/main/java/org/sonar/api/Plugin.java");
index 1563d32fd9f89661cd4f02fd15df61b0fe7066f3..13e61149899dee250f2141ef5831186a52d9d6dc 100644 (file)
@@ -125,8 +125,8 @@ public class SearchActionTest {
   @Test
   public void search_by_key_query() throws IOException {
     insertProjectsAuthorizedForUser(
-      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("project-_%-key"),
-      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("project-key-without-escaped-characters"));
+      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("project-_%-key"),
+      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("project-key-without-escaped-characters"));
 
     SearchWsResponse response = call(new SearchWsRequest().setQuery("project-_%-key").setQualifiers(singletonList(PROJECT)));
 
@@ -136,14 +136,14 @@ public class SearchActionTest {
   @Test
   public void search_for_files() throws IOException {
     ComponentDto project = ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization());
-    ComponentDto file1 = newFileDto(project).setKey("file1");
-    ComponentDto file2 = newFileDto(project).setKey("file2");
+    ComponentDto file1 = newFileDto(project).setDbKey("file1");
+    ComponentDto file2 = newFileDto(project).setDbKey("file2");
     db.components().insertComponents(project, file1, file2);
     setBrowsePermissionOnUser(project);
 
-    SearchWsResponse response = call(new SearchWsRequest().setQuery(file1.key()).setQualifiers(singletonList(FILE)));
+    SearchWsResponse response = call(new SearchWsRequest().setQuery(file1.getDbKey()).setQualifiers(singletonList(FILE)));
 
-    assertThat(response.getComponentsList()).extracting(Component::getKey).containsOnly(file1.getKey());
+    assertThat(response.getComponentsList()).extracting(Component::getKey).containsOnly(file1.getDbKey());
   }
 
   @Test
@@ -151,7 +151,7 @@ public class SearchActionTest {
     OrganizationDto organizationDto = db.organizations().insert();
     List<ComponentDto> componentDtoList = new ArrayList<>();
     for (int i = 1; i <= 9; i++) {
-      componentDtoList.add(newPrivateProjectDto(organizationDto, "project-uuid-" + i).setKey("project-key-" + i).setName("Project Name " + i));
+      componentDtoList.add(newPrivateProjectDto(organizationDto, "project-uuid-" + i).setDbKey("project-key-" + i).setName("Project Name " + i));
     }
     insertProjectsAuthorizedForUser(componentDtoList.toArray(new ComponentDto[] {}));
 
@@ -164,8 +164,8 @@ public class SearchActionTest {
   public void search_with_language() throws IOException {
     OrganizationDto organizationDto = db.organizations().insert();
     insertProjectsAuthorizedForUser(
-      ComponentTesting.newPrivateProjectDto(organizationDto).setKey("java-project").setLanguage("java"),
-      ComponentTesting.newPrivateProjectDto(organizationDto).setKey("cpp-project").setLanguage("cpp"));
+      ComponentTesting.newPrivateProjectDto(organizationDto).setDbKey("java-project").setLanguage("java"),
+      ComponentTesting.newPrivateProjectDto(organizationDto).setDbKey("cpp-project").setLanguage("cpp"));
 
     SearchWsResponse response = call(new SearchWsRequest().setOrganization(organizationDto.getKey()).setLanguage("java").setQualifiers(singletonList(PROJECT)));
 
@@ -175,35 +175,35 @@ public class SearchActionTest {
   @Test
   public void return_only_components_from_projects_on_which_user_has_browse_permission() throws IOException {
     ComponentDto project1 = ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization());
-    ComponentDto file1 = newFileDto(project1).setKey("file1");
-    ComponentDto file2 = newFileDto(project1).setKey("file2");
+    ComponentDto file1 = newFileDto(project1).setDbKey("file1");
+    ComponentDto file2 = newFileDto(project1).setDbKey("file2");
     ComponentDto project2 = ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization());
-    ComponentDto file3 = newFileDto(project2).setKey("file3");
+    ComponentDto file3 = newFileDto(project2).setDbKey("file3");
     db.components().insertComponents(project1, file1, file2, project2, file3);
     setBrowsePermissionOnUser(project1);
 
     SearchWsResponse response = call(new SearchWsRequest().setQualifiers(singletonList(FILE)));
 
-    assertThat(response.getComponentsList()).extracting(Component::getKey).containsOnly(file1.getKey(), file2.getKey());
+    assertThat(response.getComponentsList()).extracting(Component::getKey).containsOnly(file1.getDbKey(), file2.getDbKey());
   }
 
   @Test
   public void return_project_key() throws IOException {
     ComponentDto project = ComponentTesting.newPublicProjectDto(db.getDefaultOrganization());
     ComponentDto module = ComponentTesting.newModuleDto(project);
-    ComponentDto file1 = newFileDto(module).setKey("file1");
-    ComponentDto file2 = newFileDto(module).setKey("file2");
-    ComponentDto file3 = newFileDto(project).setKey("file3");
+    ComponentDto file1 = newFileDto(module).setDbKey("file1");
+    ComponentDto file2 = newFileDto(module).setDbKey("file2");
+    ComponentDto file3 = newFileDto(project).setDbKey("file3");
     db.components().insertComponents(project, module, file1, file2, file3);
 
     SearchWsResponse response = call(new SearchWsRequest().setQualifiers(asList(PROJECT, MODULE, FILE)));
 
     assertThat(response.getComponentsList()).extracting(Component::getKey, Component::getProject)
-      .containsOnly(tuple(project.getKey(), project.getKey()),
-        tuple(module.getKey(), project.getKey()),
-        tuple(file1.getKey(), project.getKey()),
-        tuple(file2.getKey(), project.getKey()),
-        tuple(file3.getKey(), project.getKey()));
+      .containsOnly(tuple(project.getDbKey(), project.getDbKey()),
+        tuple(module.getDbKey(), project.getDbKey()),
+        tuple(file1.getDbKey(), project.getDbKey()),
+        tuple(file2.getDbKey(), project.getDbKey()),
+        tuple(file3.getDbKey(), project.getDbKey()));
   }
 
   @Test
@@ -221,7 +221,7 @@ public class SearchActionTest {
     assertThat(call(request).getComponentsCount()).isZero();
 
     userSession.logIn().setRoot();
-    assertThat(call(request).getComponentsList()).extracting(Component::getKey).containsOnly(file1.getKey(), file2.getKey());
+    assertThat(call(request).getComponentsList()).extracting(Component::getKey).containsOnly(file1.getDbKey(), file2.getDbKey());
   }
 
   @Test
@@ -244,11 +244,11 @@ public class SearchActionTest {
   public void test_json_example() {
     OrganizationDto organizationDto = db.organizations().insertForKey("my-org-1");
     db.components().insertComponent(newView(organizationDto));
-    ComponentDto project = newPrivateProjectDto(organizationDto, "project-uuid").setName("Project Name").setKey("project-key");
-    ComponentDto module = newModuleDto("module-uuid", project).setName("Module Name").setKey("module-key");
-    ComponentDto directory = newDirectory(module, "path/to/directoy").setUuid("directory-uuid").setKey("directory-key").setName("Directory Name");
+    ComponentDto project = newPrivateProjectDto(organizationDto, "project-uuid").setName("Project Name").setDbKey("project-key");
+    ComponentDto module = newModuleDto("module-uuid", project).setName("Module Name").setDbKey("module-key");
+    ComponentDto directory = newDirectory(module, "path/to/directoy").setUuid("directory-uuid").setDbKey("directory-key").setName("Directory Name");
     db.components().insertComponents(project, module, directory,
-      newFileDto(module, directory, "file-uuid").setKey("file-key").setLanguage("java").setName("File Name"));
+      newFileDto(module, directory, "file-uuid").setDbKey("file-key").setLanguage("java").setName("File Name"));
     userSession.addProjectPermission(UserRole.USER, project);
 
     String response = ws.newRequest()
index 2ff7aa96d7eb041c5e1a429e0a004f1352d769df..9776dba9604508f7fd04675e43c2d25c0b07297b 100644 (file)
@@ -89,7 +89,6 @@ import static org.sonar.core.util.stream.MoreCollectors.toList;
 import static org.sonar.server.computation.task.projectanalysis.metric.Metric.MetricType.DATA;
 import static org.sonar.server.computation.task.projectanalysis.metric.Metric.MetricType.PERCENT;
 import static org.sonar.server.computation.task.projectanalysis.metric.Metric.MetricType.RATING;
-import static org.sonar.server.es.ProjectIndexer.Cause.PROJECT_CREATION;
 import static org.sonar.test.JsonAssert.assertJson;
 import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_FILTER;
 import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_ORGANIZATION;
@@ -198,14 +197,14 @@ public class SearchProjectsActionTest {
     OrganizationDto organization1Dto = db.organizations().insertForKey("my-org-key-1");
     OrganizationDto organization2Dto = db.organizations().insertForKey("my-org-key-2");
     ComponentDto project1 = insertProject(organization1Dto, c -> c
-      .setKey(KeyExamples.KEY_PROJECT_EXAMPLE_001)
+      .setDbKey(KeyExamples.KEY_PROJECT_EXAMPLE_001)
       .setName("My Project 1")
       .setTagsString("finance, java"));
     insertProject(organization1Dto, c -> c
-      .setKey(KeyExamples.KEY_PROJECT_EXAMPLE_002)
+      .setDbKey(KeyExamples.KEY_PROJECT_EXAMPLE_002)
       .setName("My Project 2"));
     insertProject(organization2Dto, c -> c
-      .setKey(KeyExamples.KEY_PROJECT_EXAMPLE_003)
+      .setDbKey(KeyExamples.KEY_PROJECT_EXAMPLE_003)
       .setName("My Project 3")
       .setTagsString("sales, offshore, java"));
     addFavourite(project1);
@@ -277,7 +276,7 @@ public class SearchProjectsActionTest {
 
     SearchProjectsWsResponse result = call(request.setFilter("coverage <= 80 and ncloc <= 10000"));
 
-    assertThat(result.getComponentsList()).extracting(Component::getKey).containsExactly(project2.key());
+    assertThat(result.getComponentsList()).extracting(Component::getKey).containsExactly(project2.getDbKey());
   }
 
   @Test
@@ -293,13 +292,13 @@ public class SearchProjectsActionTest {
 
     assertThat(call(request.setOrganization(null)).getComponentsList())
       .extracting(Component::getKey)
-      .containsOnly(project1.getKey(), project2.getKey(), project3.getKey());
+      .containsOnly(project1.getDbKey(), project2.getDbKey(), project3.getDbKey());
     assertThat(call(request.setOrganization(organization1.getKey())).getComponentsList())
       .extracting(Component::getKey)
-      .containsOnly(project1.getKey(), project2.getKey());
+      .containsOnly(project1.getDbKey(), project2.getDbKey());
     assertThat(call(request.setOrganization(organization2.getKey())).getComponentsList())
       .extracting(Component::getKey)
-      .containsOnly(project3.getKey());
+      .containsOnly(project3.getDbKey());
   }
 
   @Test
@@ -315,7 +314,7 @@ public class SearchProjectsActionTest {
 
     assertThat(result.getComponentsList())
       .extracting(Component::getKey)
-      .containsExactlyInAnyOrder(project1.getKey(), project2.getKey());
+      .containsExactlyInAnyOrder(project1.getDbKey(), project2.getDbKey());
   }
 
   @Test
@@ -330,7 +329,7 @@ public class SearchProjectsActionTest {
 
     SearchProjectsWsResponse result = call(request.setFilter("languages IN (java, js, <null>)"));
 
-    assertThat(result.getComponentsList()).extracting(Component::getKey).containsExactlyInAnyOrder(project1.getKey(), project2.getKey(), project4.getKey());
+    assertThat(result.getComponentsList()).extracting(Component::getKey).containsExactlyInAnyOrder(project1.getDbKey(), project2.getDbKey(), project4.getDbKey());
   }
 
   @Test
@@ -345,7 +344,7 @@ public class SearchProjectsActionTest {
 
     SearchProjectsWsResponse result = call(request.setFilter(metricKey + " = 2"));
 
-    assertThat(result.getComponentsList()).extracting(Component::getKey).containsExactly(project2.getKey());
+    assertThat(result.getComponentsList()).extracting(Component::getKey).containsExactly(project2.getDbKey());
   }
 
   @Test
@@ -360,7 +359,7 @@ public class SearchProjectsActionTest {
 
     SearchProjectsWsResponse result = call(request.setFilter(newMetricKey + " = 2"));
 
-    assertThat(result.getComponentsList()).extracting(Component::getKey).containsExactly(project2.getKey());
+    assertThat(result.getComponentsList()).extracting(Component::getKey).containsExactly(project2.getDbKey());
   }
 
   @Test
@@ -373,7 +372,7 @@ public class SearchProjectsActionTest {
 
     SearchProjectsWsResponse result = call(request.setFilter("tags in (finance, offshore)"));
 
-    assertThat(result.getComponentsList()).extracting(Component::getKey).containsExactlyInAnyOrder(project1.getKey(), project3.getKey());
+    assertThat(result.getComponentsList()).extracting(Component::getKey).containsExactlyInAnyOrder(project1.getDbKey(), project3.getDbKey());
   }
 
   @Test
@@ -387,7 +386,7 @@ public class SearchProjectsActionTest {
 
     SearchProjectsWsResponse result = call(request.setFilter("coverage <= 80"));
 
-    assertThat(result.getComponentsList()).extracting(Component::getKey).containsExactlyInAnyOrder(project1.getKey(), project3.key());
+    assertThat(result.getComponentsList()).extracting(Component::getKey).containsExactlyInAnyOrder(project1.getDbKey(), project3.getDbKey());
   }
 
   @Test
@@ -401,7 +400,7 @@ public class SearchProjectsActionTest {
 
     SearchProjectsWsResponse result = call(request.setFilter("new_coverage <= 80"));
 
-    assertThat(result.getComponentsList()).extracting(Component::getKey).containsExactlyInAnyOrder(project1.getKey(), project3.key());
+    assertThat(result.getComponentsList()).extracting(Component::getKey).containsExactlyInAnyOrder(project1.getDbKey(), project3.getDbKey());
   }
 
   @Test
@@ -415,7 +414,7 @@ public class SearchProjectsActionTest {
 
     SearchProjectsWsResponse result = call(request.setFilter("duplicated_lines_density <= 80"));
 
-    assertThat(result.getComponentsList()).extracting(Component::getKey).containsExactlyInAnyOrder(project1.getKey(), project3.key());
+    assertThat(result.getComponentsList()).extracting(Component::getKey).containsExactlyInAnyOrder(project1.getDbKey(), project3.getDbKey());
   }
 
   @Test
@@ -430,7 +429,7 @@ public class SearchProjectsActionTest {
 
     SearchProjectsWsResponse result = call(request.setFilter("duplicated_lines_density = NO_DATA"));
 
-    assertThat(result.getComponentsList()).extracting(Component::getKey).containsExactlyInAnyOrder(project1.getKey());
+    assertThat(result.getComponentsList()).extracting(Component::getKey).containsExactlyInAnyOrder(project1.getDbKey());
   }
 
   @Test
@@ -457,7 +456,7 @@ public class SearchProjectsActionTest {
 
     SearchProjectsWsResponse result = call(request.setFilter("new_duplicated_lines_density <= 80"));
 
-    assertThat(result.getComponentsList()).extracting(Component::getKey).containsExactlyInAnyOrder(project1.getKey(), project3.key());
+    assertThat(result.getComponentsList()).extracting(Component::getKey).containsExactlyInAnyOrder(project1.getDbKey(), project3.getDbKey());
   }
 
   @Test
@@ -471,7 +470,7 @@ public class SearchProjectsActionTest {
 
     SearchProjectsWsResponse result = call(request.setFilter("ncloc <= 80"));
 
-    assertThat(result.getComponentsList()).extracting(Component::getKey).containsExactlyInAnyOrder(project1.getKey(), project3.key());
+    assertThat(result.getComponentsList()).extracting(Component::getKey).containsExactlyInAnyOrder(project1.getDbKey(), project3.getDbKey());
   }
 
   @Test
@@ -485,17 +484,17 @@ public class SearchProjectsActionTest {
 
     SearchProjectsWsResponse result = call(request.setFilter("new_lines <= 80"));
 
-    assertThat(result.getComponentsList()).extracting(Component::getKey).containsExactlyInAnyOrder(project1.getKey(), project3.key());
+    assertThat(result.getComponentsList()).extracting(Component::getKey).containsExactlyInAnyOrder(project1.getDbKey(), project3.getDbKey());
   }
 
   @Test
   public void filter_projects_by_text_query() {
     userSession.logIn();
     OrganizationDto organizationDto = db.organizations().insert();
-    insertProject(organizationDto, c -> c.setKey("sonar-java").setName("Sonar Java"));
-    insertProject(organizationDto, c -> c.setKey("sonar-groovy").setName("Sonar Groovy"));
-    insertProject(organizationDto, c -> c.setKey("sonar-markdown").setName("Sonar Markdown"));
-    insertProject(organizationDto, c -> c.setKey("sonarqube").setName("Sonar Qube"));
+    insertProject(organizationDto, c -> c.setDbKey("sonar-java").setName("Sonar Java"));
+    insertProject(organizationDto, c -> c.setDbKey("sonar-groovy").setName("Sonar Groovy"));
+    insertProject(organizationDto, c -> c.setDbKey("sonar-markdown").setName("Sonar Markdown"));
+    insertProject(organizationDto, c -> c.setDbKey("sonarqube").setName("Sonar Qube"));
 
     assertThat(call(request.setFilter("query = \"Groovy\"")).getComponentsList()).extracting(Component::getName).containsOnly("Sonar Groovy");
     assertThat(call(request.setFilter("query = \"oNar\"")).getComponentsList()).extracting(Component::getName).containsOnly("Sonar Java", "Sonar Groovy", "Sonar Markdown",
@@ -561,7 +560,7 @@ public class SearchProjectsActionTest {
     SearchProjectsWsResponse result = call(request.setFilter("isFavorite"));
 
     assertThat(result.getComponentsCount()).isEqualTo(2);
-    assertThat(result.getComponentsList()).extracting(Component::getKey).containsExactly(javaProject.getKey(), markDownProject.getKey());
+    assertThat(result.getComponentsList()).extracting(Component::getKey).containsExactly(javaProject.getDbKey(), markDownProject.getDbKey());
   }
 
   @Test
@@ -945,9 +944,9 @@ public class SearchProjectsActionTest {
     ComponentDto project4 = insertProject(organizationDto, c -> c.setName("Sonar Qube"), new Measure(coverage, c -> c.setValue(80d)));
 
     assertThat(call(request.setSort(COVERAGE).setAsc(true)).getComponentsList()).extracting(Component::getKey)
-      .containsExactly(project3.getKey(), project4.getKey(), project2.getKey(), project1.getKey());
+      .containsExactly(project3.getDbKey(), project4.getDbKey(), project2.getDbKey(), project1.getDbKey());
     assertThat(call(request.setSort(COVERAGE).setAsc(false)).getComponentsList()).extracting(Component::getKey)
-      .containsExactly(project2.getKey(), project1.getKey(), project3.getKey(), project4.getKey());
+      .containsExactly(project2.getDbKey(), project1.getDbKey(), project3.getDbKey(), project4.getDbKey());
   }
 
   @Test
@@ -961,34 +960,34 @@ public class SearchProjectsActionTest {
     ComponentDto project4 = insertProject(organization, c -> c.setName("Sonar Qube"), new Measure(qualityGateStatus, c -> c.setData("OK")));
 
     assertThat(call(request.setSort(QUALITY_GATE_STATUS).setAsc(true)).getComponentsList()).extracting(Component::getKey)
-      .containsExactly(project3.getKey(), project4.getKey(), project2.getKey(), project1.getKey());
+      .containsExactly(project3.getDbKey(), project4.getDbKey(), project2.getDbKey(), project1.getDbKey());
     assertThat(call(request.setSort(QUALITY_GATE_STATUS).setAsc(false)).getComponentsList()).extracting(Component::getKey)
-      .containsExactly(project1.getKey(), project2.getKey(), project3.getKey(), project4.getKey());
+      .containsExactly(project1.getDbKey(), project2.getDbKey(), project3.getDbKey(), project4.getDbKey());
   }
 
   @Test
   public void sort_by_last_analysis_date() throws Exception {
     userSession.logIn();
     OrganizationDto organization = db.organizations().insert();
-    ComponentDto project1 = db.components().insertPublicProject(organization, p -> p.setKey("project1"));
+    ComponentDto project1 = db.components().insertPublicProject(organization, p -> p.setDbKey("project1"));
     authorizationIndexerTester.allowOnlyAnyone(project1);
-    ComponentDto project2 = db.components().insertPublicProject(organization, p -> p.setKey("project2"));
+    ComponentDto project2 = db.components().insertPublicProject(organization, p -> p.setDbKey("project2"));
     db.components().insertSnapshot(project2, snapshot -> snapshot.setCreatedAt(40_000_000_000L).setLast(true));
     authorizationIndexerTester.allowOnlyAnyone(project2);
-    ComponentDto project3 = db.components().insertPublicProject(organization, p -> p.setKey("project3"));
+    ComponentDto project3 = db.components().insertPublicProject(organization, p -> p.setDbKey("project3"));
     db.components().insertSnapshot(project3, snapshot -> snapshot.setCreatedAt(20_000_000_000L).setLast(true));
     authorizationIndexerTester.allowOnlyAnyone(project3);
-    ComponentDto project4 = db.components().insertPublicProject(organization, p -> p.setKey("project4"));
+    ComponentDto project4 = db.components().insertPublicProject(organization, p -> p.setDbKey("project4"));
     db.components().insertSnapshot(project4, snapshot -> snapshot.setCreatedAt(10_000_000_000L).setLast(false));
     db.components().insertSnapshot(project4, snapshot -> snapshot.setCreatedAt(30_000_000_000L).setLast(true));
     authorizationIndexerTester.allowOnlyAnyone(project4);
     projectMeasuresIndexer.indexOnStartup(null);
 
     assertThat(call(request.setSort(ANALYSIS_DATE).setAsc(true)).getComponentsList()).extracting(Component::getKey)
-      .containsExactly(project3.getKey(), project4.getKey(), project2.getKey(), project1.getKey());
+      .containsExactly(project3.getDbKey(), project4.getDbKey(), project2.getDbKey(), project1.getDbKey());
 
     assertThat(call(request.setSort(ANALYSIS_DATE).setAsc(false)).getComponentsList()).extracting(Component::getKey)
-      .containsExactly(project2.getKey(), project4.getKey(), project3.getKey(), project1.getKey());
+      .containsExactly(project2.getDbKey(), project4.getDbKey(), project3.getDbKey(), project1.getDbKey());
   }
 
   @Test
@@ -1011,9 +1010,9 @@ public class SearchProjectsActionTest {
 
     assertThat(result.getComponentsList()).extracting(Component::getKey, Component::hasAnalysisDate, Component::getAnalysisDate)
       .containsOnly(
-        tuple(project1.getKey(), true, formatDateTime(new Date(20_000_000_000L))),
-        tuple(project2.getKey(), true, formatDateTime(new Date(30_000_000_000L))),
-        tuple(project3.getKey(), false, ""));
+        tuple(project1.getDbKey(), true, formatDateTime(new Date(20_000_000_000L))),
+        tuple(project2.getDbKey(), true, formatDateTime(new Date(30_000_000_000L))),
+        tuple(project3.getDbKey(), false, ""));
   }
 
   @Test
@@ -1036,9 +1035,9 @@ public class SearchProjectsActionTest {
 
     assertThat(result.getComponentsList()).extracting(Component::getKey, Component::hasLeakPeriodDate, Component::getLeakPeriodDate)
       .containsOnly(
-        tuple(project1.getKey(), true, formatDateTime(new Date(10_000_000_000L))),
-        tuple(project2.getKey(), false, ""),
-        tuple(project3.getKey(), false, ""));
+        tuple(project1.getDbKey(), true, formatDateTime(new Date(10_000_000_000L))),
+        tuple(project2.getDbKey(), false, ""),
+        tuple(project3.getDbKey(), false, ""));
   }
 
   @Test
@@ -1055,8 +1054,8 @@ public class SearchProjectsActionTest {
 
     assertThat(result.getComponentsList()).extracting(Component::getKey, Component::getVisibility)
       .containsExactly(
-        tuple(privateProject.getKey(), privateProject.isPrivate() ? "private" : "public"),
-        tuple(publicProject.getKey(), publicProject.isPrivate() ? "private" : "public"));
+        tuple(privateProject.getDbKey(), privateProject.isPrivate() ? "private" : "public"),
+        tuple(publicProject.getDbKey(), publicProject.isPrivate() ? "private" : "public"));
   }
 
   @Test
index 35da6c1c234b6cb4ce9d09d2b5a1a3541bd555a1..ad0b6ccf7002fb6c491e78278e44925c244ee178 100644 (file)
@@ -151,10 +151,10 @@ public class ShowActionTest {
     ComponentDto file = db.components().insertComponent(newFileDto(directory));
     userSession.addProjectPermission(USER, project);
 
-    ShowWsResponse response = newRequest(null, file.key());
+    ShowWsResponse response = newRequest(null, file.getDbKey());
 
-    assertThat(response.getComponent().getKey()).isEqualTo(file.key());
-    assertThat(response.getAncestorsList()).extracting(WsComponents.Component::getKey).containsOnly(directory.key(), module.key(), project.key());
+    assertThat(response.getComponent().getKey()).isEqualTo(file.getDbKey());
+    assertThat(response.getAncestorsList()).extracting(WsComponents.Component::getKey).containsOnly(directory.getDbKey(), module.getDbKey(), project.getDbKey());
   }
 
   @Test
@@ -163,9 +163,9 @@ public class ShowActionTest {
     db.components().insertComponent(newModuleDto(project));
     userSession.addProjectPermission(USER, project);
 
-    ShowWsResponse response = newRequest(null, project.key());
+    ShowWsResponse response = newRequest(null, project.getDbKey());
 
-    assertThat(response.getComponent().getKey()).isEqualTo(project.key());
+    assertThat(response.getComponent().getKey()).isEqualTo(project.getDbKey());
     assertThat(response.getAncestorsList()).isEmpty();
   }
 
@@ -178,7 +178,7 @@ public class ShowActionTest {
       newAnalysis(project).setCreatedAt(3_000_000_000L).setLast(true));
     userSession.addProjectPermission(USER, project);
 
-    ShowWsResponse response = newRequest(null, project.key());
+    ShowWsResponse response = newRequest(null, project.getDbKey());
 
     assertThat(response.getComponent().getAnalysisDate()).isNotEmpty().isEqualTo(formatDateTime(new Date(3_000_000_000L)));
   }
@@ -193,7 +193,7 @@ public class ShowActionTest {
 
     userSession.addProjectPermission(USER, project);
 
-    ShowWsResponse response = newRequest(null, project.key());
+    ShowWsResponse response = newRequest(null, project.getDbKey());
 
     assertThat(response.getComponent().getLeakPeriodDate()).isNotEmpty().isEqualTo(formatDateTime(new Date(3_000_000_000L)));
   }
@@ -207,7 +207,7 @@ public class ShowActionTest {
     ComponentDto file = db.components().insertComponent(newFileDto(directory));
     userSession.addProjectPermission(USER, project);
 
-    ShowWsResponse response = newRequest(null, file.key());
+    ShowWsResponse response = newRequest(null, file.getDbKey());
 
     String expectedDate = formatDateTime(new Date(3_000_000_000L));
     assertThat(response.getAncestorsList()).extracting(WsComponents.Component::getAnalysisDate)
@@ -219,7 +219,7 @@ public class ShowActionTest {
     userSession.logIn().setRoot();
     ComponentDto privateProject = db.components().insertPrivateProject();
 
-    ShowWsResponse result = newRequest(null, privateProject.key());
+    ShowWsResponse result = newRequest(null, privateProject.getDbKey());
     assertThat(result.getComponent().hasVisibility()).isTrue();
     assertThat(result.getComponent().getVisibility()).isEqualTo("private");
   }
@@ -229,7 +229,7 @@ public class ShowActionTest {
     userSession.logIn().setRoot();
     ComponentDto publicProject = db.components().insertPublicProject();
 
-    ShowWsResponse result = newRequest(null, publicProject.key());
+    ShowWsResponse result = newRequest(null, publicProject.getDbKey());
     assertThat(result.getComponent().hasVisibility()).isTrue();
     assertThat(result.getComponent().getVisibility()).isEqualTo("public");
   }
@@ -239,7 +239,7 @@ public class ShowActionTest {
     userSession.logIn().setRoot();
     ComponentDto view = db.components().insertView();
 
-    ShowWsResponse result = newRequest(null, view.key());
+    ShowWsResponse result = newRequest(null, view.getDbKey());
     assertThat(result.getComponent().hasVisibility()).isTrue();
   }
 
@@ -249,7 +249,7 @@ public class ShowActionTest {
     ComponentDto privateProject = db.components().insertPrivateProject();
     ComponentDto module = db.components().insertComponent(newModuleDto(privateProject));
 
-    ShowWsResponse result = newRequest(null, module.key());
+    ShowWsResponse result = newRequest(null, module.getDbKey());
     assertThat(result.getComponent().hasVisibility()).isFalse();
   }
 
@@ -275,7 +275,7 @@ public class ShowActionTest {
   public void fail_if_component_is_removed() {
     userSession.logIn().setRoot();
     ComponentDto project = db.components().insertComponent(newPrivateProjectDto(db.getDefaultOrganization()));
-    db.components().insertComponent(newFileDto(project).setKey("file-key").setEnabled(false));
+    db.components().insertComponent(newFileDto(project).setDbKey("file-key").setEnabled(false));
 
     expectedException.expect(NotFoundException.class);
     expectedException.expectMessage("Component key 'file-key' not found");
@@ -297,7 +297,7 @@ public class ShowActionTest {
   private void insertJsonExampleComponentsAndSnapshots() {
     OrganizationDto organizationDto = db.organizations().insertForKey("my-org-1");
     ComponentDto project = db.components().insertComponent(newPrivateProjectDto(organizationDto, "AVIF98jgA3Ax6PH2efOW")
-      .setKey("com.sonarsource:java-markdown")
+      .setDbKey("com.sonarsource:java-markdown")
       .setName("Java Markdown")
       .setDescription("Java Markdown Project")
       .setQualifier(Qualifiers.PROJECT)
@@ -306,13 +306,13 @@ public class ShowActionTest {
       .setCreatedAt(parseDateTime("2017-03-01T11:39:03+0100").getTime())
       .setPeriodDate(parseDateTime("2017-01-01T11:39:03+0100").getTime()));
     ComponentDto directory = newDirectory(project, "AVIF-FfgA3Ax6PH2efPF", "src/main/java/com/sonarsource/markdown/impl")
-      .setKey("com.sonarsource:java-markdown:src/main/java/com/sonarsource/markdown/impl")
+      .setDbKey("com.sonarsource:java-markdown:src/main/java/com/sonarsource/markdown/impl")
       .setName("src/main/java/com/sonarsource/markdown/impl")
       .setQualifier(Qualifiers.DIRECTORY);
     db.components().insertComponent(directory);
     db.components().insertComponent(
       newFileDto(directory, directory, "AVIF-FffA3Ax6PH2efPD")
-        .setKey("com.sonarsource:java-markdown:src/main/java/com/sonarsource/markdown/impl/Rule.java")
+        .setDbKey("com.sonarsource:java-markdown:src/main/java/com/sonarsource/markdown/impl/Rule.java")
         .setName("Rule.java")
         .setPath("src/main/java/com/sonarsource/markdown/impl/Rule.java")
         .setLanguage("java")
index b7caf99fd1a4a228f27f79015ac6fb8deaa3a8a4..31630bfaae7a1aee1dc7c4702e40acb70c8c6cc9 100644 (file)
@@ -140,15 +140,15 @@ public class SuggestionsActionTest {
   @Test
   public void test_example_json_response() {
     OrganizationDto organization = db.organizations().insert(o -> o.setKey("default-organization").setName("Default Organization"));
-    ComponentDto project1 = db.components().insertPublicProject(organization, p -> p.setKey("org.sonarsource:sonarqube").setName("SonarSource :: SonarQube"));
-    ComponentDto project2 = db.components().insertPublicProject(organization, p -> p.setKey("org.sonarsource:sonarlint").setName("SonarSource :: SonarLint"));
+    ComponentDto project1 = db.components().insertPublicProject(organization, p -> p.setDbKey("org.sonarsource:sonarqube").setName("SonarSource :: SonarQube"));
+    ComponentDto project2 = db.components().insertPublicProject(organization, p -> p.setDbKey("org.sonarsource:sonarlint").setName("SonarSource :: SonarLint"));
     componentIndexer.indexOnStartup(null);
     authorizationIndexerTester.allowOnlyAnyone(project1);
     authorizationIndexerTester.allowOnlyAnyone(project2);
 
     TestResponse wsResponse = ws.newRequest()
       .setParam(PARAM_QUERY, "Sonar")
-      .setParam(PARAM_RECENTLY_BROWSED, project1.key())
+      .setParam(PARAM_RECENTLY_BROWSED, project1.getDbKey())
       .setMethod("POST")
       .setMediaType(MediaTypes.JSON)
       .execute();
@@ -165,7 +165,7 @@ public class SuggestionsActionTest {
 
     SuggestionsWsResponse response = ws.newRequest()
       .setMethod("POST")
-      .setParam(PARAM_RECENTLY_BROWSED, project.getKey())
+      .setParam(PARAM_RECENTLY_BROWSED, project.getDbKey())
       .executeProtobuf(SuggestionsWsResponse.class);
 
     // assert match in qualifier "TRK"
@@ -178,7 +178,7 @@ public class SuggestionsActionTest {
     assertThat(response.getResultsList())
       .flatExtracting(Category::getItemsList)
       .extracting(Suggestion::getKey, Suggestion::getIsRecentlyBrowsed)
-      .containsExactly(tuple(project.getKey(), true));
+      .containsExactly(tuple(project.getDbKey(), true));
   }
 
   @Test
@@ -189,7 +189,7 @@ public class SuggestionsActionTest {
 
     SuggestionsWsResponse response = ws.newRequest()
       .setMethod("POST")
-      .setParam(PARAM_RECENTLY_BROWSED, project.getKey())
+      .setParam(PARAM_RECENTLY_BROWSED, project.getDbKey())
       .executeProtobuf(SuggestionsWsResponse.class);
 
     // assert match in qualifier "TRK"
@@ -202,7 +202,7 @@ public class SuggestionsActionTest {
     assertThat(response.getResultsList())
       .flatExtracting(Category::getItemsList)
       .extracting(Suggestion::getKey, Suggestion::getIsRecentlyBrowsed)
-      .containsExactly(tuple(project.getKey(), true));
+      .containsExactly(tuple(project.getDbKey(), true));
   }
 
   @Test
@@ -213,7 +213,7 @@ public class SuggestionsActionTest {
 
     SuggestionsWsResponse response = ws.newRequest()
       .setMethod("POST")
-      .setParam(PARAM_RECENTLY_BROWSED, project.getKey())
+      .setParam(PARAM_RECENTLY_BROWSED, project.getDbKey())
       .executeProtobuf(SuggestionsWsResponse.class);
 
     assertThat(response.getResultsList())
@@ -243,7 +243,7 @@ public class SuggestionsActionTest {
     assertThat(response.getResultsList())
       .flatExtracting(Category::getItemsList)
       .extracting(Suggestion::getKey, Suggestion::getIsFavorite)
-      .containsExactly(tuple(project.getKey(), true));
+      .containsExactly(tuple(project.getDbKey(), true));
   }
 
   @Test
@@ -272,7 +272,7 @@ public class SuggestionsActionTest {
 
     SuggestionsWsResponse response = ws.newRequest()
       .setMethod("POST")
-      .setParam(PARAM_RECENTLY_BROWSED, project.key())
+      .setParam(PARAM_RECENTLY_BROWSED, project.getDbKey())
       .executeProtobuf(SuggestionsWsResponse.class);
 
     // assert match in qualifier "TRK"
@@ -285,7 +285,7 @@ public class SuggestionsActionTest {
     assertThat(response.getResultsList())
       .flatExtracting(Category::getItemsList)
       .extracting(Suggestion::getKey, Suggestion::getIsFavorite, Suggestion::getIsRecentlyBrowsed)
-      .containsExactly(tuple(project.getKey(), true, true));
+      .containsExactly(tuple(project.getDbKey(), true, true));
   }
 
   @Test
@@ -322,7 +322,7 @@ public class SuggestionsActionTest {
 
     SuggestionsWsResponse response = ws.newRequest()
       .setMethod("POST")
-      .setParam(PARAM_RECENTLY_BROWSED, Stream.of(project3, project1).map(ComponentDto::getKey).collect(joining(",")))
+      .setParam(PARAM_RECENTLY_BROWSED, Stream.of(project3, project1).map(ComponentDto::getDbKey).collect(joining(",")))
       .executeProtobuf(SuggestionsWsResponse.class);
 
     // assert order of keys
@@ -344,7 +344,7 @@ public class SuggestionsActionTest {
 
     SuggestionsWsResponse response = ws.newRequest()
       .setMethod("POST")
-      .setParam(PARAM_RECENTLY_BROWSED, project.key())
+      .setParam(PARAM_RECENTLY_BROWSED, project.getDbKey())
       .executeProtobuf(SuggestionsWsResponse.class);
 
     assertThat(response.getResultsList())
@@ -361,7 +361,7 @@ public class SuggestionsActionTest {
 
     SuggestionsWsResponse response = ws.newRequest()
       .setMethod("POST")
-      .setParam(PARAM_RECENTLY_BROWSED, project.key())
+      .setParam(PARAM_RECENTLY_BROWSED, project.getDbKey())
       .executeProtobuf(SuggestionsWsResponse.class);
 
     assertThat(response.getResultsList())
@@ -378,7 +378,7 @@ public class SuggestionsActionTest {
 
     SuggestionsWsResponse response = ws.newRequest()
       .setMethod("POST")
-      .setParam(PARAM_QUERY, project.getKey())
+      .setParam(PARAM_QUERY, project.getDbKey())
       .executeProtobuf(SuggestionsWsResponse.class);
 
     // assert match in qualifier "TRK"
@@ -391,7 +391,7 @@ public class SuggestionsActionTest {
     assertThat(response.getResultsList())
       .flatExtracting(Category::getItemsList)
       .extracting(Suggestion::getKey, Suggestion::getOrganization)
-      .containsExactly(tuple(project.getKey(), organization.getKey()));
+      .containsExactly(tuple(project.getDbKey(), organization.getKey()));
   }
 
   @Test
@@ -435,7 +435,7 @@ public class SuggestionsActionTest {
     assertThat(response.getResultsList())
       .flatExtracting(Category::getItemsList)
       .extracting(Suggestion::getKey)
-      .contains(project.getKey());
+      .contains(project.getDbKey());
     assertThat(response.getWarning()).contains(SHORT_INPUT_WARNING);
   }
 
@@ -455,7 +455,7 @@ public class SuggestionsActionTest {
     assertThat(response.getResultsList())
       .flatExtracting(Category::getItemsList)
       .extracting(Suggestion::getKey, Suggestion::getName)
-      .containsExactlyInAnyOrder(tuple(project1.getKey(), project1.name()));
+      .containsExactlyInAnyOrder(tuple(project1.getDbKey(), project1.name()));
   }
 
   @Test
@@ -499,12 +499,12 @@ public class SuggestionsActionTest {
     assertThat(response.getResultsList())
       .flatExtracting(Category::getItemsList)
       .extracting(Suggestion::getProject)
-      .containsOnly(project.key());
+      .containsOnly(project.getDbKey());
 
     assertThat(response.getProjectsList())
       .extracting(Project::getKey, Project::getName)
       .containsExactlyInAnyOrder(
-        tuple(project.key(), project.longName()));
+        tuple(project.getDbKey(), project.longName()));
   }
 
   @Test
@@ -520,7 +520,7 @@ public class SuggestionsActionTest {
     SuggestionsWsResponse response = ws.newRequest()
       .setMethod("POST")
       .setParam(PARAM_QUERY, "Module")
-      .setParam(PARAM_RECENTLY_BROWSED, Stream.of(module1.getKey()).collect(joining(",")))
+      .setParam(PARAM_RECENTLY_BROWSED, Stream.of(module1.getDbKey()).collect(joining(",")))
       .executeProtobuf(SuggestionsWsResponse.class);
 
     assertThat(response.getResultsList())
@@ -549,7 +549,7 @@ public class SuggestionsActionTest {
     assertThat(response.getResultsList())
       .flatExtracting(Category::getItemsList)
       .extracting(Suggestion::getKey, Suggestion::getIsFavorite)
-      .containsExactly(tuple(favorite.getKey(), true), tuple(nonFavorite.getKey(), false));
+      .containsExactly(tuple(favorite.getDbKey(), true), tuple(nonFavorite.getDbKey(), false));
   }
 
   @Test
index d49b293753adce9e3848adc5e1be85399b19634a..98f6a1d5cb5b9b6db27ecd7d8a22a1beb2f7b4bf 100644 (file)
@@ -231,7 +231,7 @@ public class TreeActionTest {
     OrganizationDto organizationDto = db.organizations().insert();
     ComponentDto view = newView(organizationDto, "view-uuid");
     componentDb.insertViewAndSnapshot(view);
-    ComponentDto project = newPrivateProjectDto(organizationDto, "project-uuid-1").setName("project-name").setKey("project-key-1");
+    ComponentDto project = newPrivateProjectDto(organizationDto, "project-uuid-1").setName("project-name").setDbKey("project-key-1");
     componentDb.insertProjectAndSnapshot(project);
     componentDb.insertComponent(newProjectCopy("project-uuid-1-copy", project, view));
     componentDb.insertComponent(newSubView(view, "sub-view-uuid", "sub-view-key").setName("sub-view-name"));
@@ -358,7 +358,7 @@ public class TreeActionTest {
   @Test
   public void fail_when_base_component_is_removed() {
     ComponentDto project = componentDb.insertComponent(newPrivateProjectDto(db.getDefaultOrganization()));
-    componentDb.insertComponent(ComponentTesting.newFileDto(project).setKey("file-key").setEnabled(false));
+    componentDb.insertComponent(ComponentTesting.newFileDto(project).setDbKey("file-key").setEnabled(false));
     logInWithBrowsePermission(project);
 
     expectedException.expect(NotFoundException.class);
@@ -380,7 +380,7 @@ public class TreeActionTest {
   private static ComponentDto newFileDto(ComponentDto moduleOrProject, @Nullable ComponentDto directory, int i) {
     return ComponentTesting.newFileDto(moduleOrProject, directory, "file-uuid-" + i)
       .setName("file-name-" + i)
-      .setKey("file-key-" + i)
+      .setDbKey("file-key-" + i)
       .setPath("file-path-" + i);
   }
 
@@ -391,7 +391,7 @@ public class TreeActionTest {
   private ComponentDto initJsonExampleComponents() throws IOException {
     OrganizationDto organizationDto = db.organizations().insertForKey("my-org-1");
     ComponentDto project = newPrivateProjectDto(organizationDto, "MY_PROJECT_ID")
-      .setKey("MY_PROJECT_KEY")
+      .setDbKey("MY_PROJECT_KEY")
       .setName("Project Name");
     componentDb.insertProjectAndSnapshot(project);
     Date now = new Date();
@@ -402,7 +402,7 @@ public class TreeActionTest {
       JsonObject componentAsJsonObject = componentAsJsonElement.getAsJsonObject();
       String uuid = getJsonField(componentAsJsonObject, "id");
       componentDb.insertComponent(newChildComponent(uuid, project, project)
-        .setKey(getJsonField(componentAsJsonObject, "key"))
+        .setDbKey(getJsonField(componentAsJsonObject, "key"))
         .setName(getJsonField(componentAsJsonObject, "name"))
         .setLanguage(getJsonField(componentAsJsonObject, "language"))
         .setPath(getJsonField(componentAsJsonObject, "path"))
index 73ca3e90a9d5de6ee31bdb6d2311724ae77fe0c5..1ff0cd12cadd27d3ead0879d1fa3590503600f6f 100644 (file)
@@ -106,7 +106,7 @@ public class ReportSubmitterTest {
     ComponentDto project = db.components().insertPrivateProject(organization);
     mockSuccessfulPrepareSubmitCall();
 
-    underTest.submit(organization.getKey(), project.getKey(), null, project.name(), IOUtils.toInputStream("{binary}"));
+    underTest.submit(organization.getKey(), project.getDbKey(), null, project.name(), IOUtils.toInputStream("{binary}"));
   }
 
   @Test
@@ -116,7 +116,7 @@ public class ReportSubmitterTest {
 
     mockSuccessfulPrepareSubmitCall();
 
-    underTest.submit(defaultOrganizationKey, project.getKey(), null, project.name(), IOUtils.toInputStream("{binary}"));
+    underTest.submit(defaultOrganizationKey, project.getDbKey(), null, project.name(), IOUtils.toInputStream("{binary}"));
 
     verifyReportIsPersisted(TASK_UUID);
     verifyZeroInteractions(permissionTemplateService);
@@ -143,7 +143,7 @@ public class ReportSubmitterTest {
       .addPermission(PROVISION_PROJECTS, organization);
 
     mockSuccessfulPrepareSubmitCall();
-    ComponentDto createdProject = newPrivateProjectDto(organization, PROJECT_UUID).setKey(PROJECT_KEY);
+    ComponentDto createdProject = newPrivateProjectDto(organization, PROJECT_UUID).setDbKey(PROJECT_KEY);
     when(componentUpdater.create(any(DbSession.class), any(NewComponent.class), eq(null))).thenReturn(createdProject);
     when(permissionTemplateService.wouldUserHaveScanPermissionWithDefaultTemplate(any(DbSession.class), eq(organization.getUuid()), anyInt(), anyString(),
       eq(PROJECT_KEY), eq(Qualifiers.PROJECT)))
@@ -174,7 +174,7 @@ public class ReportSubmitterTest {
       .addPermission(PROVISION_PROJECTS, db.getDefaultOrganization());
 
     mockSuccessfulPrepareSubmitCall();
-    ComponentDto createdProject = newPrivateProjectDto(db.getDefaultOrganization(), PROJECT_UUID).setKey(PROJECT_KEY);
+    ComponentDto createdProject = newPrivateProjectDto(db.getDefaultOrganization(), PROJECT_UUID).setDbKey(PROJECT_KEY);
     when(componentUpdater.create(any(DbSession.class), any(NewComponent.class), eq(null))).thenReturn(createdProject);
     when(permissionTemplateService.wouldUserHaveScanPermissionWithDefaultTemplate(any(DbSession.class), eq(defaultOrganizationUuid), anyInt(), anyString(),
       eq(PROJECT_KEY), eq(Qualifiers.PROJECT)))
@@ -193,7 +193,7 @@ public class ReportSubmitterTest {
       .addPermission(PROVISION_PROJECTS, db.getDefaultOrganization());
 
     mockSuccessfulPrepareSubmitCall();
-    ComponentDto project = newPrivateProjectDto(db.getDefaultOrganization(), PROJECT_UUID).setKey(PROJECT_KEY);
+    ComponentDto project = newPrivateProjectDto(db.getDefaultOrganization(), PROJECT_UUID).setDbKey(PROJECT_KEY);
     when(componentUpdater.create(any(DbSession.class), any(NewComponent.class), eq(null))).thenReturn(project);
     when(permissionTemplateService.wouldUserHaveScanPermissionWithDefaultTemplate(any(DbSession.class), eq(defaultOrganizationUuid), anyInt(), anyString(),
       eq(PROJECT_KEY), eq(Qualifiers.PROJECT)))
@@ -212,7 +212,7 @@ public class ReportSubmitterTest {
 
     mockSuccessfulPrepareSubmitCall();
 
-    underTest.submit(org.getKey(), project.getKey(), null, project.name(), IOUtils.toInputStream("{binary}"));
+    underTest.submit(org.getKey(), project.getDbKey(), null, project.name(), IOUtils.toInputStream("{binary}"));
 
     verify(queue).submit(any(CeTaskSubmit.class));
   }
@@ -224,7 +224,7 @@ public class ReportSubmitterTest {
 
     mockSuccessfulPrepareSubmitCall();
 
-    underTest.submit(defaultOrganizationKey, project.getKey(), null, project.name(), IOUtils.toInputStream("{binary}"));
+    underTest.submit(defaultOrganizationKey, project.getDbKey(), null, project.name(), IOUtils.toInputStream("{binary}"));
 
     verify(queue).submit(any(CeTaskSubmit.class));
   }
@@ -241,7 +241,7 @@ public class ReportSubmitterTest {
     userSession.addProjectPermission(SCAN_EXECUTION, ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization(), PROJECT_UUID));
 
     mockSuccessfulPrepareSubmitCall();
-    when(componentUpdater.create(any(DbSession.class), any(NewComponent.class), eq(null))).thenReturn(new ComponentDto().setUuid(PROJECT_UUID).setKey(PROJECT_KEY));
+    when(componentUpdater.create(any(DbSession.class), any(NewComponent.class), eq(null))).thenReturn(new ComponentDto().setUuid(PROJECT_UUID).setDbKey(PROJECT_KEY));
 
     thrown.expect(ForbiddenException.class);
     underTest.submit(defaultOrganizationKey, PROJECT_KEY, null, PROJECT_NAME, IOUtils.toInputStream("{binary}"));
@@ -257,10 +257,10 @@ public class ReportSubmitterTest {
 
     // user does not have the "scan" permission on the branch, so it can't scan it
     String branchName = "branchFoo";
-    ComponentDto branchProject = db.components().insertPrivateProject(p -> p.setKey(mainProject.getKey() + ":" + branchName));
+    ComponentDto branchProject = db.components().insertPrivateProject(p -> p.setDbKey(mainProject.getDbKey() + ":" + branchName));
 
     thrown.expect(ForbiddenException.class);
-    underTest.submit(defaultOrganizationKey, mainProject.key(), branchName, PROJECT_NAME, IOUtils.toInputStream("{binary}"));
+    underTest.submit(defaultOrganizationKey, mainProject.getDbKey(), branchName, PROJECT_NAME, IOUtils.toInputStream("{binary}"));
   }
 
   private void verifyReportIsPersisted(String taskUuid) {
index a2800c3272c13df31ab24f37823755562e7d45ef..383de8d5030d3b0baabd980c2278d8193b609de1 100644 (file)
@@ -75,7 +75,7 @@ public class ConfigurationRepositoryTest {
 
   @Test
   public void get_project_settings_from_db() {
-    ComponentDto project = ComponentTesting.newPrivateProjectDto(dbTester.organizations().insert()).setKey(ROOT.getKey());
+    ComponentDto project = ComponentTesting.newPrivateProjectDto(dbTester.organizations().insert()).setDbKey(ROOT.getKey());
     dbClient.componentDao().insert(session, project);
     dbClient.propertiesDao().saveProperty(session, new PropertyDto().setResourceId(project.getId()).setKey("key").setValue("value"));
     session.commit();
index 451edc64090a72d4f468c56fc3d812c510c0e088..350705e1bc1ace0ac36ee1e9ae383ba53f72adef 100644 (file)
@@ -323,7 +323,7 @@ public class FileMoveDetectionStepTest {
     assertThat(movedFilesRepository.getComponentsWithOriginal()).containsExactly(FILE_2);
     MovedFilesRepository.OriginalFile originalFile = movedFilesRepository.getOriginalFile(FILE_2).get();
     assertThat(originalFile.getId()).isEqualTo(dtos[0].getId());
-    assertThat(originalFile.getKey()).isEqualTo(dtos[0].getKey());
+    assertThat(originalFile.getKey()).isEqualTo(dtos[0].getDbKey());
     assertThat(originalFile.getUuid()).isEqualTo(dtos[0].uuid());
   }
 
@@ -446,11 +446,11 @@ public class FileMoveDetectionStepTest {
     assertThat(movedFilesRepository.getComponentsWithOriginal()).containsOnly(FILE_3, file6);
     MovedFilesRepository.OriginalFile originalFile2 = movedFilesRepository.getOriginalFile(FILE_3).get();
     assertThat(originalFile2.getId()).isEqualTo(dtos[0].getId());
-    assertThat(originalFile2.getKey()).isEqualTo(dtos[0].getKey());
+    assertThat(originalFile2.getKey()).isEqualTo(dtos[0].getDbKey());
     assertThat(originalFile2.getUuid()).isEqualTo(dtos[0].uuid());
     MovedFilesRepository.OriginalFile originalFile5 = movedFilesRepository.getOriginalFile(file6).get();
     assertThat(originalFile5.getId()).isEqualTo(dtos[3].getId());
-    assertThat(originalFile5.getKey()).isEqualTo(dtos[3].getKey());
+    assertThat(originalFile5.getKey()).isEqualTo(dtos[3].getDbKey());
     assertThat(originalFile5.getUuid()).isEqualTo(dtos[3].uuid());
   }
 
@@ -541,7 +541,7 @@ public class FileMoveDetectionStepTest {
     ComponentDto res = new ComponentDto();
     res
       .setId(dbIdGenerator)
-      .setKey(key)
+      .setDbKey(key)
       .setUuid(componentUuidOf(key))
       .setPath("path_" + key);
     dbIdGenerator++;
index 89c69ce0d8612c64639368d0331b1ab7e7b158bc..10e91e8a7eb9a400f124e096d43aa793448316aa 100644 (file)
@@ -276,8 +276,8 @@ public class IntegrateIssuesVisitorTest {
   }
 
   private void addBaseIssue(RuleKey ruleKey) {
-    ComponentDto project = ComponentTesting.newPrivateProjectDto(dbTester.organizations().insert(), PROJECT_UUID).setKey(PROJECT_KEY);
-    ComponentDto file = ComponentTesting.newFileDto(project, null, FILE_UUID).setKey(FILE_KEY);
+    ComponentDto project = ComponentTesting.newPrivateProjectDto(dbTester.organizations().insert(), PROJECT_UUID).setDbKey(PROJECT_KEY);
+    ComponentDto file = ComponentTesting.newFileDto(project, null, FILE_UUID).setDbKey(FILE_KEY);
     dbTester.getDbClient().componentDao().insert(dbTester.getSession(), project, file);
 
     RuleDto ruleDto = RuleTesting.newDto(ruleKey);
index 02dc51461cde4c34f38d4fdea62103ec0590f755..06bce8981c175f57d903cb42b907b96ba379c9ed 100644 (file)
@@ -170,11 +170,11 @@ public class BuildComponentTreeStepTest {
   @Test
   public void return_existing_uuids() {
     OrganizationDto organizationDto = dbTester.organizations().insert();
-    ComponentDto project = insertComponent(newPrivateProjectDto(organizationDto, "ABCD").setKey(REPORT_PROJECT_KEY));
-    ComponentDto module = insertComponent(newModuleDto("BCDE", project).setKey(REPORT_MODULE_KEY));
+    ComponentDto project = insertComponent(newPrivateProjectDto(organizationDto, "ABCD").setDbKey(REPORT_PROJECT_KEY));
+    ComponentDto module = insertComponent(newModuleDto("BCDE", project).setDbKey(REPORT_MODULE_KEY));
     ComponentDto directory = newDirectory(module, "CDEF", REPORT_DIR_KEY_1);
-    insertComponent(directory.setKey(REPORT_MODULE_KEY + ":" + REPORT_DIR_KEY_1));
-    insertComponent(newFileDto(module, directory, "DEFG").setKey(REPORT_MODULE_KEY + ":" + REPORT_FILE_KEY_1));
+    insertComponent(directory.setDbKey(REPORT_MODULE_KEY + ":" + REPORT_DIR_KEY_1));
+    insertComponent(newFileDto(module, directory, "DEFG").setDbKey(REPORT_MODULE_KEY + ":" + REPORT_FILE_KEY_1));
 
     reportReader.putComponent(componentWithKey(ROOT_REF, PROJECT, REPORT_PROJECT_KEY, MODULE_REF));
     reportReader.putComponent(componentWithKey(MODULE_REF, MODULE, REPORT_MODULE_KEY, DIR_REF_1));
@@ -250,10 +250,10 @@ public class BuildComponentTreeStepTest {
   @Test
   public void return_existing_uuids_when_components_were_removed() {
     OrganizationDto organizationDto = dbTester.organizations().insert();
-    ComponentDto project = insertComponent(newPrivateProjectDto(organizationDto, "ABCD").setKey(REPORT_PROJECT_KEY));
-    ComponentDto removedModule = insertComponent(newModuleDto("BCDE", project).setKey(REPORT_MODULE_KEY).setEnabled(false));
-    ComponentDto removedDirectory = insertComponent(newDirectory(removedModule, "CDEF", REPORT_DIR_KEY_1).setKey(REPORT_MODULE_KEY + ":" + REPORT_DIR_KEY_1).setEnabled(false));
-    insertComponent(newFileDto(removedModule, removedDirectory, "DEFG").setKey(REPORT_MODULE_KEY + ":" + REPORT_FILE_KEY_1).setEnabled(false));
+    ComponentDto project = insertComponent(newPrivateProjectDto(organizationDto, "ABCD").setDbKey(REPORT_PROJECT_KEY));
+    ComponentDto removedModule = insertComponent(newModuleDto("BCDE", project).setDbKey(REPORT_MODULE_KEY).setEnabled(false));
+    ComponentDto removedDirectory = insertComponent(newDirectory(removedModule, "CDEF", REPORT_DIR_KEY_1).setDbKey(REPORT_MODULE_KEY + ":" + REPORT_DIR_KEY_1).setEnabled(false));
+    insertComponent(newFileDto(removedModule, removedDirectory, "DEFG").setDbKey(REPORT_MODULE_KEY + ":" + REPORT_FILE_KEY_1).setEnabled(false));
 
     reportReader.putComponent(componentWithKey(ROOT_REF, PROJECT, REPORT_PROJECT_KEY, MODULE_REF));
     reportReader.putComponent(componentWithKey(MODULE_REF, MODULE, REPORT_MODULE_KEY, DIR_REF_1));
@@ -281,7 +281,7 @@ public class BuildComponentTreeStepTest {
   @Test
   public void set_no_base_project_snapshot_when_no_last_snapshot() throws Exception {
     OrganizationDto organizationDto = dbTester.organizations().insert();
-    ComponentDto project = insertComponent(newPrivateProjectDto(organizationDto, "ABCD").setKey(REPORT_PROJECT_KEY));
+    ComponentDto project = insertComponent(newPrivateProjectDto(organizationDto, "ABCD").setDbKey(REPORT_PROJECT_KEY));
     insertSnapshot(newAnalysis(project).setLast(false));
 
     reportReader.putComponent(componentWithKey(ROOT_REF, PROJECT, REPORT_PROJECT_KEY));
@@ -293,7 +293,7 @@ public class BuildComponentTreeStepTest {
   @Test
   public void set_base_project_snapshot_when_last_snapshot_exist() throws Exception {
     OrganizationDto organizationDto = dbTester.organizations().insert();
-    ComponentDto project = insertComponent(newPrivateProjectDto(organizationDto, "ABCD").setKey(REPORT_PROJECT_KEY));
+    ComponentDto project = insertComponent(newPrivateProjectDto(organizationDto, "ABCD").setDbKey(REPORT_PROJECT_KEY));
     insertSnapshot(newAnalysis(project).setLast(true));
 
     reportReader.putComponent(componentWithKey(ROOT_REF, PROJECT, REPORT_PROJECT_KEY));
index d9e9bdb33af9051b858b3f04a1842e73942b44cd..f8a9fc057cda22de812ff5c58d0b837be2fdfee3 100644 (file)
@@ -164,7 +164,7 @@ public class LoadCrossProjectDuplicationsRepositoryStepTest {
           .build()),
       Arrays.asList(
         new Block.Builder()
-          .setResourceId(otherFile.getKey())
+          .setResourceId(otherFile.getDbKey())
           .setBlockHash(new ByteArray(hash))
           .setIndexInFile(duplicate.getIndexInFile())
           .setLines(duplicate.getStartLine(), duplicate.getEndLine())
@@ -245,14 +245,14 @@ public class LoadCrossProjectDuplicationsRepositoryStepTest {
     Map<Integer, Block> duplicationBlocksByIndex = blocksByIndexInFile(duplicationBlocks.getValue());
     assertThat(duplicationBlocksByIndex.get(0)).isEqualTo(
       new Block.Builder()
-        .setResourceId(otherFile.getKey())
+        .setResourceId(otherFile.getDbKey())
         .setBlockHash(new ByteArray(originBlock1.getHash()))
         .setIndexInFile(duplicate1.getIndexInFile())
         .setLines(duplicate1.getStartLine(), duplicate1.getEndLine())
         .build());
     assertThat(duplicationBlocksByIndex.get(1)).isEqualTo(
       new Block.Builder()
-        .setResourceId(otherFile.getKey())
+        .setResourceId(otherFile.getDbKey())
         .setBlockHash(new ByteArray(originBlock2.getHash()))
         .setIndexInFile(duplicate2.getIndexInFile())
         .setLines(duplicate2.getStartLine(), duplicate2.getEndLine())
@@ -326,7 +326,7 @@ public class LoadCrossProjectDuplicationsRepositoryStepTest {
   }
 
   private ComponentDto createProject(String projectKey) {
-    ComponentDto project = ComponentTesting.newPrivateProjectDto(dbTester.organizations().insert()).setKey(projectKey);
+    ComponentDto project = ComponentTesting.newPrivateProjectDto(dbTester.organizations().insert()).setDbKey(projectKey);
     dbClient.componentDao().insert(dbSession, project);
     dbSession.commit();
     return project;
@@ -341,7 +341,7 @@ public class LoadCrossProjectDuplicationsRepositoryStepTest {
 
   private ComponentDto createFile(String fileKey, ComponentDto project) {
     ComponentDto file = ComponentTesting.newFileDto(project, null)
-      .setKey(fileKey)
+      .setDbKey(fileKey)
       .setLanguage(XOO_LANGUAGE);
     dbClient.componentDao().insert(dbSession, file);
     dbSession.commit();
index 1906f71b5e4a557339475e6d00a3a82b16745b66..61d0099b1576b2d977ffd781ce63dbe61b22641c 100644 (file)
@@ -382,7 +382,7 @@ public class PersistMeasuresStepTest extends BaseStepTest {
   private ComponentDto addComponent(String key, String uuid) {
     ComponentDto componentDto = new ComponentDto()
       .setOrganizationUuid("org1")
-      .setKey(key)
+      .setDbKey(key)
       .setUuid(uuid)
       .setUuidPath(uuid + ".")
       .setRootUuid(uuid)
index ecbadf519574cf5fd2b8d7a6290b2de00ae51102..40fbf42f13384a631dbc63e7935ca41740640b7a 100644 (file)
@@ -99,13 +99,13 @@ public class ReportPersistAnalysisStepTest extends BaseStepTest {
   @Test
   public void persist_analysis() {
     OrganizationDto organizationDto = dbTester.organizations().insert();
-    ComponentDto projectDto = ComponentTesting.newPrivateProjectDto(organizationDto, "ABCD").setKey(PROJECT_KEY).setName("Project");
+    ComponentDto projectDto = ComponentTesting.newPrivateProjectDto(organizationDto, "ABCD").setDbKey(PROJECT_KEY).setName("Project");
     dbClient.componentDao().insert(dbTester.getSession(), projectDto);
-    ComponentDto moduleDto = ComponentTesting.newModuleDto("BCDE", projectDto).setKey("MODULE_KEY").setName("Module");
+    ComponentDto moduleDto = ComponentTesting.newModuleDto("BCDE", projectDto).setDbKey("MODULE_KEY").setName("Module");
     dbClient.componentDao().insert(dbTester.getSession(), moduleDto);
-    ComponentDto directoryDto = ComponentTesting.newDirectory(moduleDto, "CDEF", "MODULE_KEY:src/main/java/dir").setKey("MODULE_KEY:src/main/java/dir");
+    ComponentDto directoryDto = ComponentTesting.newDirectory(moduleDto, "CDEF", "MODULE_KEY:src/main/java/dir").setDbKey("MODULE_KEY:src/main/java/dir");
     dbClient.componentDao().insert(dbTester.getSession(), directoryDto);
-    ComponentDto fileDto = ComponentTesting.newFileDto(moduleDto, directoryDto, "DEFG").setKey("MODULE_KEY:src/main/java/dir/Foo.java");
+    ComponentDto fileDto = ComponentTesting.newFileDto(moduleDto, directoryDto, "DEFG").setDbKey("MODULE_KEY:src/main/java/dir/Foo.java");
     dbClient.componentDao().insert(dbTester.getSession(), fileDto);
     dbTester.getSession().commit();
 
@@ -141,7 +141,7 @@ public class ReportPersistAnalysisStepTest extends BaseStepTest {
   @Test
   public void persist_snapshots_with_leak_period() {
     OrganizationDto organizationDto = dbTester.organizations().insert();
-    ComponentDto projectDto = ComponentTesting.newPrivateProjectDto(organizationDto, "ABCD").setKey(PROJECT_KEY).setName("Project");
+    ComponentDto projectDto = ComponentTesting.newPrivateProjectDto(organizationDto, "ABCD").setDbKey(PROJECT_KEY).setName("Project");
     dbClient.componentDao().insert(dbTester.getSession(), projectDto);
     SnapshotDto snapshotDto = SnapshotTesting.newAnalysis(projectDto).setCreatedAt(DateUtils.parseDateQuietly("2015-01-01").getTime());
     dbClient.snapshotDao().insert(dbTester.getSession(), snapshotDto);
@@ -165,18 +165,18 @@ public class ReportPersistAnalysisStepTest extends BaseStepTest {
     periodsHolder.setPeriod(new Period(LEAK_PERIOD_MODE_PREVIOUS_ANALYSIS, null, analysisDate, "u1"));
 
     OrganizationDto organizationDto = dbTester.organizations().insert();
-    ComponentDto projectDto = ComponentTesting.newPrivateProjectDto(organizationDto, "ABCD").setKey(PROJECT_KEY).setName("Project");
+    ComponentDto projectDto = ComponentTesting.newPrivateProjectDto(organizationDto, "ABCD").setDbKey(PROJECT_KEY).setName("Project");
     dbClient.componentDao().insert(dbTester.getSession(), projectDto);
     SnapshotDto projectSnapshot = SnapshotTesting.newAnalysis(projectDto);
     dbClient.snapshotDao().insert(dbTester.getSession(), projectSnapshot);
 
-    ComponentDto moduleDto = ComponentTesting.newModuleDto("BCDE", projectDto).setKey("MODULE_KEY").setName("Module");
+    ComponentDto moduleDto = ComponentTesting.newModuleDto("BCDE", projectDto).setDbKey("MODULE_KEY").setName("Module");
     dbClient.componentDao().insert(dbTester.getSession(), moduleDto);
 
-    ComponentDto directoryDto = ComponentTesting.newDirectory(moduleDto, "CDEF", "MODULE_KEY:src/main/java/dir").setKey("MODULE_KEY:src/main/java/dir");
+    ComponentDto directoryDto = ComponentTesting.newDirectory(moduleDto, "CDEF", "MODULE_KEY:src/main/java/dir").setDbKey("MODULE_KEY:src/main/java/dir");
     dbClient.componentDao().insert(dbTester.getSession(), directoryDto);
 
-    ComponentDto fileDto = ComponentTesting.newFileDto(moduleDto, directoryDto, "DEFG").setKey("MODULE_KEY:src/main/java/dir/Foo.java");
+    ComponentDto fileDto = ComponentTesting.newFileDto(moduleDto, directoryDto, "DEFG").setDbKey("MODULE_KEY:src/main/java/dir/Foo.java");
     dbClient.componentDao().insert(dbTester.getSession(), fileDto);
 
     dbTester.getSession().commit();
@@ -200,7 +200,7 @@ public class ReportPersistAnalysisStepTest extends BaseStepTest {
 
   @Test
   public void set_no_period_on_snapshots_when_no_period() {
-    ComponentDto projectDto = ComponentTesting.newPrivateProjectDto(dbTester.organizations().insert(), "ABCD").setKey(PROJECT_KEY).setName("Project");
+    ComponentDto projectDto = ComponentTesting.newPrivateProjectDto(dbTester.organizations().insert(), "ABCD").setDbKey(PROJECT_KEY).setName("Project");
     dbClient.componentDao().insert(dbTester.getSession(), projectDto);
     SnapshotDto snapshotDto = SnapshotTesting.newAnalysis(projectDto);
     dbClient.snapshotDao().insert(dbTester.getSession(), snapshotDto);
index 0584c5eab5fd37c5165dc183e7fccb65dc183929..94a5e8e273bd93e7101d341a708d2787fbf204a7 100644 (file)
@@ -224,9 +224,9 @@ public class ReportPersistComponentsStepTest extends BaseStepTest {
   @Test
   public void persist_only_new_components() {
     // Project and module already exists
-    ComponentDto project = newPrivateProjectDto(dbTester.getDefaultOrganization(), "ABCD").setKey(PROJECT_KEY).setName("Project");
+    ComponentDto project = newPrivateProjectDto(dbTester.getDefaultOrganization(), "ABCD").setDbKey(PROJECT_KEY).setName("Project");
     dbClient.componentDao().insert(dbTester.getSession(), project);
-    ComponentDto module = ComponentTesting.newModuleDto("BCDE", project).setKey(MODULE_KEY).setName("Module");
+    ComponentDto module = ComponentTesting.newModuleDto("BCDE", project).setDbKey(MODULE_KEY).setName("Module");
     dbClient.componentDao().insert(dbTester.getSession(), module);
     dbTester.getSession().commit();
 
@@ -325,7 +325,7 @@ public class ReportPersistComponentsStepTest extends BaseStepTest {
   }
 
   private ReportComponent.Builder asTreeRoot(ComponentDto project) {
-    return builder(PROJECT, 1).setUuid(project.uuid()).setKey(project.key()).setName(project.name());
+    return builder(PROJECT, 1).setUuid(project.uuid()).setKey(project.getDbKey()).setName(project.name());
   }
 
   public ComponentDto insertProject() {
@@ -376,13 +376,13 @@ public class ReportPersistComponentsStepTest extends BaseStepTest {
 
   @Test
   public void nothing_to_persist() {
-    ComponentDto project = newPrivateProjectDto(dbTester.organizations().insert(), "ABCD").setKey(PROJECT_KEY).setName("Project");
+    ComponentDto project = newPrivateProjectDto(dbTester.organizations().insert(), "ABCD").setDbKey(PROJECT_KEY).setName("Project");
     dbClient.componentDao().insert(dbTester.getSession(), project);
-    ComponentDto module = ComponentTesting.newModuleDto("BCDE", project).setKey(MODULE_KEY).setName("Module");
+    ComponentDto module = ComponentTesting.newModuleDto("BCDE", project).setDbKey(MODULE_KEY).setName("Module");
     dbClient.componentDao().insert(dbTester.getSession(), module);
-    ComponentDto directory = ComponentTesting.newDirectory(module, "src/main/java/dir").setUuid("CDEF").setKey("MODULE_KEY:src/main/java/dir");
+    ComponentDto directory = ComponentTesting.newDirectory(module, "src/main/java/dir").setUuid("CDEF").setDbKey("MODULE_KEY:src/main/java/dir");
     ComponentDto file = ComponentTesting.newFileDto(module, directory, "DEFG").setPath("src/main/java/dir/Foo.java").setName("Foo.java")
-      .setKey("MODULE_KEY:src/main/java/dir/Foo.java");
+      .setDbKey("MODULE_KEY:src/main/java/dir/Foo.java");
     dbClient.componentDao().insert(dbTester.getSession(), directory, file);
     dbTester.getSession().commit();
 
@@ -451,9 +451,9 @@ public class ReportPersistComponentsStepTest extends BaseStepTest {
 
   @Test
   public void update_module_name_and_description() {
-    ComponentDto project = newPrivateProjectDto(dbTester.getDefaultOrganization(), "ABCD").setKey(PROJECT_KEY).setName("Project").setDescription("Project description");
+    ComponentDto project = newPrivateProjectDto(dbTester.getDefaultOrganization(), "ABCD").setDbKey(PROJECT_KEY).setName("Project").setDescription("Project description");
     dbClient.componentDao().insert(dbTester.getSession(), project);
-    ComponentDto module = ComponentTesting.newModuleDto("BCDE", project).setKey(MODULE_KEY).setName("Module");
+    ComponentDto module = ComponentTesting.newModuleDto("BCDE", project).setDbKey(MODULE_KEY).setName("Module");
     dbClient.componentDao().insert(dbTester.getSession(), module);
     dbTester.getSession().commit();
 
@@ -490,9 +490,9 @@ public class ReportPersistComponentsStepTest extends BaseStepTest {
 
   @Test
   public void update_module_path() {
-    ComponentDto project = newPrivateProjectDto(dbTester.organizations().insert(), "ABCD").setKey(PROJECT_KEY).setName("Project");
+    ComponentDto project = newPrivateProjectDto(dbTester.organizations().insert(), "ABCD").setDbKey(PROJECT_KEY).setName("Project");
     dbClient.componentDao().insert(dbTester.getSession(), project);
-    ComponentDto module = ComponentTesting.newModuleDto("BCDE", project).setKey(MODULE_KEY).setName("Module").setPath("path");
+    ComponentDto module = ComponentTesting.newModuleDto("BCDE", project).setDbKey(MODULE_KEY).setName("Module").setPath("path");
     dbClient.componentDao().insert(dbTester.getSession(), module);
     dbTester.getSession().commit();
 
@@ -517,18 +517,18 @@ public class ReportPersistComponentsStepTest extends BaseStepTest {
 
   @Test
   public void update_module_uuid_when_moving_a_module() {
-    ComponentDto project = newPrivateProjectDto(dbTester.getDefaultOrganization(), "ABCD").setKey(PROJECT_KEY).setName("Project");
+    ComponentDto project = newPrivateProjectDto(dbTester.getDefaultOrganization(), "ABCD").setDbKey(PROJECT_KEY).setName("Project");
     dbClient.componentDao().insert(dbTester.getSession(), project);
     ComponentDto moduleA = ComponentTesting.newModuleDto("EDCB", project)
-      .setKey("MODULE_A")
+      .setDbKey("MODULE_A")
       .setName("Module A");
     ComponentDto moduleB = ComponentTesting.newModuleDto("BCDE", project)
-      .setKey("MODULE_B")
+      .setDbKey("MODULE_B")
       .setName("Module B");
     dbClient.componentDao().insert(dbTester.getSession(), moduleA, moduleB);
-    ComponentDto directory = ComponentTesting.newDirectory(moduleB, "src/main/java/dir").setUuid("CDEF").setKey("MODULE_B:src/main/java/dir");
+    ComponentDto directory = ComponentTesting.newDirectory(moduleB, "src/main/java/dir").setUuid("CDEF").setDbKey("MODULE_B:src/main/java/dir");
     ComponentDto file = ComponentTesting.newFileDto(moduleB, directory, "DEFG").setPath("src/main/java/dir/Foo.java").setName("Foo.java")
-      .setKey("MODULE_B:src/main/java/dir/Foo.java");
+      .setDbKey("MODULE_B:src/main/java/dir/Foo.java");
     dbClient.componentDao().insert(dbTester.getSession(), directory, file);
     dbTester.getSession().commit();
 
@@ -594,9 +594,9 @@ public class ReportPersistComponentsStepTest extends BaseStepTest {
   @Test
   public void do_not_update_created_at_on_existing_component() {
     Date oldDate = DateUtils.parseDate("2015-01-01");
-    ComponentDto project = newPrivateProjectDto(dbTester.getDefaultOrganization(), "ABCD").setKey(PROJECT_KEY).setName("Project").setCreatedAt(oldDate);
+    ComponentDto project = newPrivateProjectDto(dbTester.getDefaultOrganization(), "ABCD").setDbKey(PROJECT_KEY).setName("Project").setCreatedAt(oldDate);
     dbClient.componentDao().insert(dbTester.getSession(), project);
-    ComponentDto module = ComponentTesting.newModuleDto("BCDE", project).setKey(MODULE_KEY).setName("Module").setPath("path").setCreatedAt(oldDate);
+    ComponentDto module = ComponentTesting.newModuleDto("BCDE", project).setDbKey(MODULE_KEY).setName("Module").setPath("path").setCreatedAt(oldDate);
     dbClient.componentDao().insert(dbTester.getSession(), module);
     dbTester.getSession().commit();
 
@@ -612,21 +612,21 @@ public class ReportPersistComponentsStepTest extends BaseStepTest {
 
   @Test
   public void persist_components_that_were_previously_removed() {
-    ComponentDto project = newPrivateProjectDto(dbTester.organizations().insert(), "ABCD").setKey(PROJECT_KEY).setName("Project");
+    ComponentDto project = newPrivateProjectDto(dbTester.organizations().insert(), "ABCD").setDbKey(PROJECT_KEY).setName("Project");
     dbClient.componentDao().insert(dbTester.getSession(), project);
     ComponentDto removedModule = ComponentTesting.newModuleDto("BCDE", project)
-      .setKey(MODULE_KEY)
+      .setDbKey(MODULE_KEY)
       .setName("Module")
       .setEnabled(false);
     dbClient.componentDao().insert(dbTester.getSession(), removedModule);
     ComponentDto removedDirectory = ComponentTesting.newDirectory(removedModule, "src/main/java/dir")
       .setUuid("CDEF")
-      .setKey("MODULE_KEY:src/main/java/dir")
+      .setDbKey("MODULE_KEY:src/main/java/dir")
       .setEnabled(false);
     ComponentDto removedFile = ComponentTesting.newFileDto(removedModule, removedDirectory, "DEFG")
       .setPath("src/main/java/dir/Foo.java")
       .setName("Foo.java")
-      .setKey("MODULE_KEY:src/main/java/dir/Foo.java")
+      .setDbKey("MODULE_KEY:src/main/java/dir/Foo.java")
       .setEnabled(false);
     dbClient.componentDao().insert(dbTester.getSession(), removedDirectory, removedFile);
     dbTester.getSession().commit();
@@ -655,7 +655,7 @@ public class ReportPersistComponentsStepTest extends BaseStepTest {
     assertThat(dbClient.componentDao().selectByKey(dbTester.getSession(), MODULE_KEY).get().getId()).isEqualTo(removedModule.getId());
     assertThat(dbClient.componentDao().selectByKey(dbTester.getSession(), "MODULE_KEY:src/main/java/dir").get().getId()).isEqualTo(removedDirectory.getId());
     assertThat(dbClient.componentDao().selectByKey(dbTester.getSession(), "MODULE_KEY:src/main/java/dir/Foo.java").get().getId()).isEqualTo(removedFile.getId());
-    assertExistButDisabled(removedModule.key(), removedDirectory.getKey(), removedFile.getKey());
+    assertExistButDisabled(removedModule.getDbKey(), removedDirectory.getDbKey(), removedFile.getDbKey());
 
     // commit the functional transaction
     dbClient.componentDao().applyBChangesForRootComponentUuid(dbTester.getSession(), project.uuid());
@@ -714,15 +714,15 @@ public class ReportPersistComponentsStepTest extends BaseStepTest {
 
   @Test
   public void update_module_uuid_when_reactivating_removed_component() {
-    ComponentDto project = newPrivateProjectDto(dbTester.getDefaultOrganization(), "ABCD").setKey(PROJECT_KEY).setName("Project");
+    ComponentDto project = newPrivateProjectDto(dbTester.getDefaultOrganization(), "ABCD").setDbKey(PROJECT_KEY).setName("Project");
     dbClient.componentDao().insert(dbTester.getSession(), project);
-    ComponentDto module = ComponentTesting.newModuleDto("BCDE", project).setKey(MODULE_KEY).setName("Module");
-    ComponentDto removedModule = ComponentTesting.newModuleDto("EDCD", project).setKey("REMOVED_MODULE_KEY").setName("Removed Module").setEnabled(false);
+    ComponentDto module = ComponentTesting.newModuleDto("BCDE", project).setDbKey(MODULE_KEY).setName("Module");
+    ComponentDto removedModule = ComponentTesting.newModuleDto("EDCD", project).setDbKey("REMOVED_MODULE_KEY").setName("Removed Module").setEnabled(false);
     dbClient.componentDao().insert(dbTester.getSession(), module, removedModule);
-    ComponentDto directory = ComponentTesting.newDirectory(module, "src/main/java/dir").setUuid("CDEF").setKey("MODULE_KEY:src/main/java/dir");
+    ComponentDto directory = ComponentTesting.newDirectory(module, "src/main/java/dir").setUuid("CDEF").setDbKey("MODULE_KEY:src/main/java/dir");
     // The file was attached to another module
     ComponentDto removedFile = ComponentTesting.newFileDto(removedModule, directory, "DEFG").setPath("src/main/java/dir/Foo.java").setName("Foo.java")
-      .setKey("MODULE_KEY:src/main/java/dir/Foo.java").setEnabled(false);
+      .setDbKey("MODULE_KEY:src/main/java/dir/Foo.java").setEnabled(false);
     dbClient.componentDao().insert(dbTester.getSession(), directory, removedFile);
     dbTester.getSession().commit();
 
@@ -770,11 +770,11 @@ public class ReportPersistComponentsStepTest extends BaseStepTest {
   public void persists_existing_components_with_visibility_of_root_in_db_out_of_functional_transaction() {
     boolean isRootPrivate = new Random().nextBoolean();
     OrganizationDto organization = dbTester.organizations().insert();
-    ComponentDto project = newPrivateProjectDto(organization, "ABCD").setKey(PROJECT_KEY).setName("Project").setPrivate(isRootPrivate);
+    ComponentDto project = newPrivateProjectDto(organization, "ABCD").setDbKey(PROJECT_KEY).setName("Project").setPrivate(isRootPrivate);
     dbTester.components().insertComponent(project);
-    ComponentDto module = newModuleDto(project).setUuid("BCDE").setKey("MODULE").setPrivate(!isRootPrivate);
+    ComponentDto module = newModuleDto(project).setUuid("BCDE").setDbKey("MODULE").setPrivate(!isRootPrivate);
     dbTester.components().insertComponent(module);
-    dbTester.components().insertComponent(newDirectory(module, "DEFG", "Directory").setKey("DIR").setPrivate(isRootPrivate));
+    dbTester.components().insertComponent(newDirectory(module, "DEFG", "Directory").setDbKey("DIR").setPrivate(isRootPrivate));
     treeRootHolder.setRoot(createSampleProjectComponentTree(project));
 
     underTest.execute();
@@ -786,7 +786,7 @@ public class ReportPersistComponentsStepTest extends BaseStepTest {
   }
 
   private ReportComponent createSampleProjectComponentTree(ComponentDto project) {
-    return createSampleProjectComponentTree(project.uuid(), project.key());
+    return createSampleProjectComponentTree(project.uuid(), project.getDbKey());
   }
 
   private ReportComponent createSampleProjectComponentTree(String projectUuid, String projectKey) {
index 082456cde60f8c27f5bf750c4616544069194ef5..f1c0120b2913afd3d051de3e30538503ef21a8cd 100644 (file)
@@ -36,9 +36,9 @@ import org.sonar.scanner.protocol.output.ScannerReport;
 import org.sonar.scanner.protocol.output.ScannerReport.Component.ComponentType;
 import org.sonar.server.computation.task.projectanalysis.analysis.AnalysisMetadataHolderRule;
 import org.sonar.server.computation.task.projectanalysis.batch.BatchReportReaderRule;
-import org.sonar.server.computation.task.projectanalysis.component.TreeRootHolderRule;
 import org.sonar.server.computation.task.projectanalysis.component.Component;
 import org.sonar.server.computation.task.projectanalysis.component.ReportComponent;
+import org.sonar.server.computation.task.projectanalysis.component.TreeRootHolderRule;
 
 public class ValidateProjectStepTest {
 
@@ -77,7 +77,7 @@ public class ValidateProjectStepTest {
       .build());
     treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).build());
 
-    ComponentDto project = ComponentTesting.newView(dbTester.organizations().insert(), "ABCD").setKey(PROJECT_KEY);
+    ComponentDto project = ComponentTesting.newView(dbTester.organizations().insert(), "ABCD").setDbKey(PROJECT_KEY);
     dbClient.componentDao().insert(dbTester.getSession(), project);
     dbTester.getSession().commit();
 
@@ -159,7 +159,7 @@ public class ValidateProjectStepTest {
       .setKey(MODULE_KEY)
       .build());
 
-    ComponentDto project = ComponentTesting.newPrivateProjectDto(dbTester.organizations().insert(), "ABCD").setKey(MODULE_KEY);
+    ComponentDto project = ComponentTesting.newPrivateProjectDto(dbTester.organizations().insert(), "ABCD").setDbKey(MODULE_KEY);
     dbClient.componentDao().insert(dbTester.getSession(), project);
     dbTester.getSession().commit();
 
@@ -192,10 +192,10 @@ public class ValidateProjectStepTest {
       .build());
 
     OrganizationDto organizationDto = dbTester.organizations().insert();
-    ComponentDto project = ComponentTesting.newPrivateProjectDto(organizationDto, "ABCD").setKey(PROJECT_KEY);
-    ComponentDto anotherProject = ComponentTesting.newPrivateProjectDto(organizationDto).setKey(anotherProjectKey);
+    ComponentDto project = ComponentTesting.newPrivateProjectDto(organizationDto, "ABCD").setDbKey(PROJECT_KEY);
+    ComponentDto anotherProject = ComponentTesting.newPrivateProjectDto(organizationDto).setDbKey(anotherProjectKey);
     dbClient.componentDao().insert(dbTester.getSession(), project, anotherProject);
-    ComponentDto module = ComponentTesting.newModuleDto("BCDE", anotherProject).setKey(MODULE_KEY);
+    ComponentDto module = ComponentTesting.newModuleDto("BCDE", anotherProject).setDbKey(MODULE_KEY);
     dbClient.componentDao().insert(dbTester.getSession(), module);
     dbTester.getSession().commit();
 
@@ -226,9 +226,9 @@ public class ValidateProjectStepTest {
       .setKey(MODULE_KEY)
       .build());
 
-    ComponentDto anotherProject = ComponentTesting.newPrivateProjectDto(dbTester.organizations().insert()).setKey(anotherProjectKey);
+    ComponentDto anotherProject = ComponentTesting.newPrivateProjectDto(dbTester.organizations().insert()).setDbKey(anotherProjectKey);
     dbClient.componentDao().insert(dbTester.getSession(), anotherProject);
-    ComponentDto module = ComponentTesting.newModuleDto("ABCD", anotherProject).setKey(PROJECT_KEY);
+    ComponentDto module = ComponentTesting.newModuleDto("ABCD", anotherProject).setDbKey(PROJECT_KEY);
     dbClient.componentDao().insert(dbTester.getSession(), module);
     dbTester.getSession().commit();
 
@@ -255,7 +255,7 @@ public class ValidateProjectStepTest {
       .addChildRef(2)
       .build());
 
-    ComponentDto project = ComponentTesting.newPrivateProjectDto(dbTester.organizations().insert(), "ABCD").setKey(PROJECT_KEY);
+    ComponentDto project = ComponentTesting.newPrivateProjectDto(dbTester.organizations().insert(), "ABCD").setDbKey(PROJECT_KEY);
     dbClient.componentDao().insert(dbTester.getSession(), project);
     dbClient.snapshotDao().insert(dbTester.getSession(), SnapshotTesting.newAnalysis(project).setCreatedAt(1420088400000L)); // 2015-01-01
     dbTester.getSession().commit();
@@ -276,7 +276,7 @@ public class ValidateProjectStepTest {
       .addChildRef(2)
       .build());
 
-    ComponentDto project = ComponentTesting.newPrivateProjectDto(dbTester.organizations().insert(), "ABCD").setKey(PROJECT_KEY);
+    ComponentDto project = ComponentTesting.newPrivateProjectDto(dbTester.organizations().insert(), "ABCD").setDbKey(PROJECT_KEY);
     dbClient.componentDao().insert(dbTester.getSession(), project);
     dbClient.snapshotDao().insert(dbTester.getSession(), SnapshotTesting.newAnalysis(project).setCreatedAt(1433131200000L)); // 2015-06-01
     dbTester.getSession().commit();
index be55fe07d57acc6733b71441bb752a0ff9934702..ba90ba20e89e444d1d50fe08299543bbd6d1e16d 100644 (file)
@@ -97,7 +97,7 @@ public class ViewsPersistAnalysisStepTest extends BaseStepTest {
   @Test
   public void persist_analysis() {
     OrganizationDto organizationDto = dbTester.organizations().insert();
-    ComponentDto viewDto = save(newView(organizationDto, "UUID_VIEW").setKey("KEY_VIEW"));
+    ComponentDto viewDto = save(newView(organizationDto, "UUID_VIEW").setDbKey("KEY_VIEW"));
     save(newSubView(viewDto, "UUID_SUBVIEW", "KEY_SUBVIEW"));
     save(newPrivateProjectDto(organizationDto, "proj"));
     dbTester.getSession().commit();
@@ -124,7 +124,7 @@ public class ViewsPersistAnalysisStepTest extends BaseStepTest {
   @Test
   public void persist_snapshots_with_leak_period() {
     OrganizationDto organizationDto = dbTester.organizations().insert();
-    ComponentDto viewDto = save(newView(organizationDto, "UUID_VIEW").setKey("KEY_VIEW"));
+    ComponentDto viewDto = save(newView(organizationDto, "UUID_VIEW").setDbKey("KEY_VIEW"));
     ComponentDto subViewDto = save(newSubView(viewDto, "UUID_SUBVIEW", "KEY_SUBVIEW"));
     dbTester.getSession().commit();
 
index e3a912378ac53a8378797b6e5f6181ad55f257b5..4cd7f3f54be1d299340fd84f619c61bddc2223fa 100644 (file)
@@ -50,8 +50,8 @@ import static org.assertj.core.api.Assertions.assertThat;
 import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
-import static org.sonar.db.component.ComponentTesting.newProjectCopy;
 import static org.sonar.db.component.ComponentTesting.newPrivateProjectDto;
+import static org.sonar.db.component.ComponentTesting.newProjectCopy;
 import static org.sonar.db.component.ComponentTesting.newSubView;
 import static org.sonar.server.computation.task.projectanalysis.component.Component.Type.PROJECT_VIEW;
 import static org.sonar.server.computation.task.projectanalysis.component.Component.Type.SUBVIEW;
@@ -301,7 +301,7 @@ public class ViewsPersistComponentsStepTest extends BaseStepTest {
     persistComponents(view, project);
     ComponentDto projectView = ComponentTesting.newProjectCopy(PROJECT_VIEW_1_UUID, project, view)
       .setOrganizationUuid(ORGANIZATION_UUID)
-      .setKey(PROJECT_VIEW_1_KEY)
+      .setDbKey(PROJECT_VIEW_1_KEY)
       .setName("Old name")
       .setCreatedAt(now);
     persistComponents(projectView);
@@ -332,7 +332,7 @@ public class ViewsPersistComponentsStepTest extends BaseStepTest {
 
     // Project view in DB is associated to project1
     ComponentDto projectView = ComponentTesting.newProjectCopy(PROJECT_VIEW_1_UUID, project1, view)
-      .setKey(PROJECT_VIEW_1_KEY)
+      .setDbKey(PROJECT_VIEW_1_KEY)
       .setCreatedAt(now);
     persistComponents(projectView);
 
@@ -399,7 +399,7 @@ public class ViewsPersistComponentsStepTest extends BaseStepTest {
     boolean isRootPrivate = new Random().nextBoolean();
     ComponentDto project = dbTester.components().insertComponent(ComponentTesting.newPrivateProjectDto(dbTester.organizations().insert()));
     OrganizationDto organization = dbTester.organizations().insert();
-    ComponentDto view = newViewDto(organization).setUuid(VIEW_UUID).setKey(VIEW_KEY).setName("View").setPrivate(isRootPrivate);
+    ComponentDto view = newViewDto(organization).setUuid(VIEW_UUID).setDbKey(VIEW_KEY).setName("View").setPrivate(isRootPrivate);
     dbTester.components().insertComponent(view);
     treeRootHolder.setRoot(
       createViewBuilder(PORTFOLIO)
@@ -423,11 +423,11 @@ public class ViewsPersistComponentsStepTest extends BaseStepTest {
     boolean isRootPrivate = new Random().nextBoolean();
     ComponentDto project = dbTester.components().insertComponent(ComponentTesting.newPrivateProjectDto(dbTester.organizations().insert()));
     OrganizationDto organization = dbTester.organizations().insert();
-    ComponentDto view = newViewDto(organization).setUuid(VIEW_UUID).setKey(VIEW_KEY).setName("View").setPrivate(isRootPrivate);
+    ComponentDto view = newViewDto(organization).setUuid(VIEW_UUID).setDbKey(VIEW_KEY).setName("View").setPrivate(isRootPrivate);
     dbTester.components().insertComponent(view);
-    ComponentDto subView = newSubView(view).setUuid("BCDE").setKey("MODULE").setPrivate(!isRootPrivate);
+    ComponentDto subView = newSubView(view).setUuid("BCDE").setDbKey("MODULE").setPrivate(!isRootPrivate);
     dbTester.components().insertComponent(subView);
-    dbTester.components().insertComponent(newProjectCopy("DEFG", project, view).setKey("DIR").setPrivate(isRootPrivate));
+    dbTester.components().insertComponent(newProjectCopy("DEFG", project, view).setDbKey("DIR").setPrivate(isRootPrivate));
     treeRootHolder.setRoot(
       createViewBuilder(PORTFOLIO)
         .addChildren(
@@ -488,7 +488,7 @@ public class ViewsPersistComponentsStepTest extends BaseStepTest {
   private ComponentDto newViewDto(OrganizationDto organizationDto) {
     return ComponentTesting.newView(organizationDto, VIEW_UUID)
       .setOrganizationUuid(ORGANIZATION_UUID)
-      .setKey(VIEW_KEY)
+      .setDbKey(VIEW_KEY)
       .setName(VIEW_NAME);
   }
 
index 2a38b5607dd67a36bb8aa5ed9bcaa00188d12d83..c7411e97adf99453344238b0841228b86f1e3d33 100644 (file)
@@ -69,21 +69,21 @@ public class DuplicationsParserTest {
     project1 = ComponentTesting.newPrivateProjectDto(organizationDto)
       .setName("SonarQube")
       .setLongName("SonarQube")
-      .setKey("org.codehaus.sonar:sonar");
+      .setDbKey("org.codehaus.sonar:sonar");
     project2 = ComponentTesting.newPrivateProjectDto(organizationDto);
     componentDao.insert(dbSession, project1, project2);
 
     // Current file
     String key1 = "org.codehaus.sonar:sonar-plugin-api:src/main/java/org/sonar/api/utils/command/CommandExecutor.java";
-    currentFile = newFileDto(project1, null).setKey(key1).setLongName("CommandExecutor");
+    currentFile = newFileDto(project1, null).setDbKey(key1).setLongName("CommandExecutor");
 
     // File on same project
     String key2 = "org.codehaus.sonar:sonar-plugin-api:src/main/java/com/sonar/orchestrator/util/CommandExecutor.java";
-    fileOnSameProject = newFileDto(project1, null).setKey(key2).setLongName("CommandExecutor");
+    fileOnSameProject = newFileDto(project1, null).setDbKey(key2).setLongName("CommandExecutor");
 
     // File on different project
     String key3 = "com.sonarsource.orchestrator:sonar-orchestrator:src/main/java/com/sonar/orchestrator/util/CommandExecutor.java";
-    fileOnDifferentProject = newFileDto(project2, null).setKey(key3).setLongName("CommandExecutor");
+    fileOnDifferentProject = newFileDto(project2, null).setDbKey(key3).setLongName("CommandExecutor");
 
     componentDao.insert(dbSession, currentFile, fileOnSameProject, fileOnDifferentProject);
     dbSession.commit();
@@ -190,7 +190,7 @@ public class DuplicationsParserTest {
     assertThat(duplication1.from()).isEqualTo(31);
     assertThat(duplication1.size()).isEqualTo(5);
 
-    DuplicationsParser.Duplication duplication2 = duplication(duplications, fileOnSameProject.key());
+    DuplicationsParser.Duplication duplication2 = duplication(duplications, fileOnSameProject.getDbKey());
     assertThat(duplication2.file()).isEqualTo(fileOnSameProject);
     assertThat(duplication2.from()).isEqualTo(20);
     assertThat(duplication2.size()).isEqualTo(5);
@@ -235,7 +235,7 @@ public class DuplicationsParserTest {
     return Iterables.find(duplications, new Predicate<DuplicationsParser.Duplication>() {
       @Override
       public boolean apply(@Nullable DuplicationsParser.Duplication input) {
-        return input != null && (componentKey == null ? input.file() == null : input.file() != null && componentKey.equals(input.file().key()));
+        return input != null && (componentKey == null ? input.file() == null : input.file() != null && componentKey.equals(input.file().getDbKey()));
       }
     });
   }
index 64774e7cc8fa0b4629601d8d9c1d2ae1b2ffa75a..49add0329a4b2b99ccb7053ac1acbcabff5752b2 100644 (file)
@@ -69,7 +69,7 @@ public class ShowActionTest {
   @Test
   public void get_duplications_by_file_key() throws Exception {
     TestRequest request = newBaseRequest();
-    verifyCallToFileWithDuplications(file -> request.setParam("key", file.key()));
+    verifyCallToFileWithDuplications(file -> request.setParam("key", file.getDbKey()));
   }
 
   @Test
@@ -81,12 +81,12 @@ public class ShowActionTest {
   @Test
   public void return_file_with_missing_duplication_data() throws Exception {
     ComponentDto project = db.components().insertPrivateProject();
-    ComponentDto file = db.components().insertComponent(newFileDto(project).setKey("foo.js"));
+    ComponentDto file = db.components().insertComponent(newFileDto(project).setDbKey("foo.js"));
     db.components().insertSnapshot(newAnalysis(project));
 
     userSessionRule.addProjectPermission(UserRole.CODEVIEWER, project);
 
-    TestResponse result = newBaseRequest().setParam("key", file.key()).execute();
+    TestResponse result = newBaseRequest().setParam("key", file.getDbKey()).execute();
 
     assertJson(result.getInput()).isSimilarTo("{\n" +
       "  \"duplications\": [],\n" +
@@ -108,7 +108,7 @@ public class ShowActionTest {
 
     expectedException.expect(ForbiddenException.class);
 
-    newBaseRequest().setParam("key", file.key()).execute();
+    newBaseRequest().setParam("key", file.getDbKey()).execute();
   }
 
   @Test
@@ -125,7 +125,7 @@ public class ShowActionTest {
 
   private void verifyCallToFileWithDuplications(Function<ComponentDto, TestRequest> requestFactory) throws Exception {
     ComponentDto project = db.components().insertPrivateProject();
-    ComponentDto file = db.components().insertComponent(newFileDto(project).setKey("foo.js"));
+    ComponentDto file = db.components().insertComponent(newFileDto(project).setDbKey("foo.js"));
     SnapshotDto snapshot = db.components().insertSnapshot(newAnalysis(project));
     String xml = "<duplications>\n" +
       "  <g>\n" +
index 8dfc52367bf51f7f0541fab01d3559aaf1151e78..878604883d57bf69495ec0394905656327015f73 100644 (file)
@@ -61,17 +61,17 @@ public class ShowResponseBuilderTest {
     project = newPrivateProjectDto(organization)
       .setName("SonarQube")
       .setLongName("SonarQube")
-      .setKey("org.codehaus.sonar:sonar");
+      .setDbKey("org.codehaus.sonar:sonar");
     db.components().insertComponent(project);
   }
 
   @Test
   public void write_duplications() {
     String key1 = "org.codehaus.sonar:sonar-ws-client:src/main/java/org/sonar/wsclient/services/PropertyDeleteQuery.java";
-    ComponentDto file1 = ComponentTesting.newFileDto(project, null).setKey(key1).setLongName("PropertyDeleteQuery").setRootUuid("uuid_5");
+    ComponentDto file1 = ComponentTesting.newFileDto(project, null).setDbKey(key1).setLongName("PropertyDeleteQuery").setRootUuid("uuid_5");
     String key2 = "org.codehaus.sonar:sonar-ws-client:src/main/java/org/sonar/wsclient/services/PropertyUpdateQuery.java";
-    ComponentDto file2 = ComponentTesting.newFileDto(project, null).setQualifier("FIL").setKey(key2).setLongName("PropertyUpdateQuery").setRootUuid("uuid_5");
-    ComponentDto project2 = db.components().insertPrivateProject(organization, p -> p.setUuid("uuid_5").setKey("org.codehaus.sonar:sonar-ws-client")
+    ComponentDto file2 = ComponentTesting.newFileDto(project, null).setQualifier("FIL").setDbKey(key2).setLongName("PropertyUpdateQuery").setRootUuid("uuid_5");
+    ComponentDto project2 = db.components().insertPrivateProject(organization, p -> p.setUuid("uuid_5").setDbKey("org.codehaus.sonar:sonar-ws-client")
       .setLongName("SonarQube :: Web Service Client"));
 
     db.components().insertComponent(file1);
@@ -126,9 +126,9 @@ public class ShowResponseBuilderTest {
   @Test
   public void write_duplications_without_sub_project() {
     String key1 = "org.codehaus.sonar:sonar-ws-client:src/main/java/org/sonar/wsclient/services/PropertyDeleteQuery.java";
-    ComponentDto file1 = ComponentTesting.newFileDto(project, null).setId(10L).setKey(key1).setLongName("PropertyDeleteQuery");
+    ComponentDto file1 = ComponentTesting.newFileDto(project, null).setId(10L).setDbKey(key1).setLongName("PropertyDeleteQuery");
     String key2 = "org.codehaus.sonar:sonar-ws-client:src/main/java/org/sonar/wsclient/services/PropertyUpdateQuery.java";
-    ComponentDto file2 = ComponentTesting.newFileDto(project, null).setId(11L).setKey(key2).setLongName("PropertyUpdateQuery");
+    ComponentDto file2 = ComponentTesting.newFileDto(project, null).setId(11L).setDbKey(key2).setLongName("PropertyUpdateQuery");
 
     db.components().insertComponent(file1);
     db.components().insertComponent(file2);
@@ -173,7 +173,7 @@ public class ShowResponseBuilderTest {
   @Test
   public void write_duplications_with_a_removed_component() {
     String key1 = "org.codehaus.sonar:sonar-ws-client:src/main/java/org/sonar/wsclient/services/PropertyDeleteQuery.java";
-    ComponentDto file1 = ComponentTesting.newFileDto(project, null).setId(10L).setKey(key1).setLongName("PropertyDeleteQuery");
+    ComponentDto file1 = ComponentTesting.newFileDto(project, null).setId(10L).setDbKey(key1).setLongName("PropertyDeleteQuery");
     db.components().insertComponent(file1);
 
     List<DuplicationsParser.Block> blocks = newArrayList();
index b99b2eae02f69d58cc6f0c71f86adceb4abf6fcf..b6a254957367b30414dad80eb1429e1dcbaa1fe7 100644 (file)
@@ -39,7 +39,7 @@ public class FavoriteUpdaterTest {
   private static final String COMPONENT_KEY = "K1";
   private static final ComponentDto COMPONENT = ComponentTesting.newPrivateProjectDto(OrganizationTesting.newOrganizationDto())
     .setId(COMPONENT_ID)
-    .setKey(COMPONENT_KEY);
+    .setDbKey(COMPONENT_KEY);
   private static final int USER_ID = 42;
 
   @Rule
index cd4c470484d97f84a9c99ef9d9324435dbf437da..41733e1e62989340df76e6684dfef26cacdcb136 100644 (file)
@@ -91,7 +91,7 @@ public class AddActionTest {
     ComponentDto file = db.components().insertComponent(newFileDto(project));
     userSession.addProjectPermission(UserRole.USER, project, file);
 
-    call(file.key());
+    call(file.getDbKey());
 
     List<PropertyDto> favorites = dbClient.propertiesDao().selectByQuery(PropertyQuery.builder()
       .setUserId(USER_ID)
@@ -143,7 +143,7 @@ public class AddActionTest {
   }
 
   private ComponentDto insertProject() {
-    return db.components().insertComponent(newPrivateProjectDto(db.organizations().insert(), PROJECT_UUID).setKey(PROJECT_KEY));
+    return db.components().insertComponent(newPrivateProjectDto(db.organizations().insert(), PROJECT_UUID).setDbKey(PROJECT_KEY));
   }
 
   private ComponentDto insertProjectAndPermissions() {
index 35a28e817557717a6ada77cfcdda7b23f00bcaaf..51a448c3521db771d3911a8c4aa1b18ede78f4f8 100644 (file)
@@ -113,7 +113,7 @@ public class RemoveActionTest {
   }
 
   private ComponentDto insertProject() {
-    return db.components().insertComponent(newPrivateProjectDto(db.organizations().insert(), PROJECT_UUID).setKey(PROJECT_KEY));
+    return db.components().insertComponent(newPrivateProjectDto(db.organizations().insert(), PROJECT_UUID).setDbKey(PROJECT_KEY));
   }
 
   private ComponentDto insertProjectAndPermissions() {
index 25dcf91d6a4f5d0731fdc1fb92acdb449a6f1043..03227994d173d48a5fd2de4c75d88efb88af3c7f 100644 (file)
@@ -67,10 +67,10 @@ public class SearchActionTest {
 
   @Test
   public void return_favorites() {
-    ComponentDto project = newPrivateProjectDto(db.getDefaultOrganization(), "P1").setKey("K1").setName("N1");
+    ComponentDto project = newPrivateProjectDto(db.getDefaultOrganization(), "P1").setDbKey("K1").setName("N1");
     addComponent(project);
-    addComponent(newFileDto(project).setKey("K11").setName("N11"));
-    addComponent(newPrivateProjectDto(db.getDefaultOrganization(), "P2").setKey("K2").setName("N2"));
+    addComponent(newFileDto(project).setDbKey("K11").setName("N11"));
+    addComponent(newPrivateProjectDto(db.getDefaultOrganization(), "P2").setDbKey("K2").setName("N2"));
 
     SearchResponse result = call();
 
@@ -96,7 +96,7 @@ public class SearchActionTest {
   @Test
   public void filter_authorized_components() {
     OrganizationDto organizationDto = db.organizations().insert();
-    addComponent(ComponentTesting.newPrivateProjectDto(organizationDto).setKey("K1"));
+    addComponent(ComponentTesting.newPrivateProjectDto(organizationDto).setDbKey("K1"));
     ComponentDto unauthorizedProject = db.components().insertComponent(ComponentTesting.newPrivateProjectDto(organizationDto));
     db.favorites().add(unauthorizedProject, USER_ID);
 
@@ -109,7 +109,7 @@ public class SearchActionTest {
   @Test
   public void paginate_results() {
     IntStream.rangeClosed(1, 9)
-      .forEach(i -> addComponent(ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("K" + i).setName("N" + i)));
+      .forEach(i -> addComponent(ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("K" + i).setName("N" + i)));
     ComponentDto unauthorizedProject = db.components().insertComponent(ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()));
     db.favorites().add(unauthorizedProject, USER_ID);
 
@@ -125,8 +125,8 @@ public class SearchActionTest {
   @Test
   public void return_only_users_favorite() {
     OrganizationDto organizationDto = db.organizations().insert();
-    addComponent(ComponentTesting.newPrivateProjectDto(organizationDto).setKey("K1"));
-    ComponentDto otherUserFavorite = ComponentTesting.newPrivateProjectDto(organizationDto).setKey("K42");
+    addComponent(ComponentTesting.newPrivateProjectDto(organizationDto).setDbKey("K1"));
+    ComponentDto otherUserFavorite = ComponentTesting.newPrivateProjectDto(organizationDto).setDbKey("K42");
     db.components().insertComponent(otherUserFavorite);
     db.favorites().add(otherUserFavorite, 42);
     db.commit();
@@ -153,9 +153,9 @@ public class SearchActionTest {
   public void json_example() {
     OrganizationDto organization1 = db.organizations().insertForKey("my-org");
     OrganizationDto organization2 = db.organizations().insertForKey("openjdk");
-    addComponent(ComponentTesting.newPrivateProjectDto(organization1).setKey("K1").setName("Samba"));
-    addComponent(ComponentTesting.newPrivateProjectDto(organization1).setKey("K2").setName("Apache HBase"));
-    addComponent(ComponentTesting.newPrivateProjectDto(organization2).setKey("K3").setName("JDK9"));
+    addComponent(ComponentTesting.newPrivateProjectDto(organization1).setDbKey("K1").setName("Samba"));
+    addComponent(ComponentTesting.newPrivateProjectDto(organization1).setDbKey("K2").setName("Apache HBase"));
+    addComponent(ComponentTesting.newPrivateProjectDto(organization2).setDbKey("K3").setName("JDK9"));
 
     String result = ws.newRequest().execute().getInput();
 
index 78a2b6a7afdcf4733020cdaf1ee5e44dbe903158..0d190400fbf7d1d855445969ba1c42fab413b227 100644 (file)
@@ -49,7 +49,7 @@ public class ActionFinderTest {
   @Rule
   public UserSessionRule userSession = UserSessionRule.standalone().logIn("arthur");
 
-  private ComponentDto project = newPrivateProjectDto(OrganizationTesting.newOrganizationDto(), PROJECT_UUID).setKey(PROJECT_KEY);
+  private ComponentDto project = newPrivateProjectDto(OrganizationTesting.newOrganizationDto(), PROJECT_UUID).setDbKey(PROJECT_KEY);
   private IssueDto issue = newDto(newXooX1().setId(10), newFileDto(project, null), project).setKee(ISSUE_KEY);
 
   private ActionFinder underTest = new ActionFinder(userSession);
index 32dca3502e192348f92fa2207736577ed6ec9474..7b02648e8b96850febe4904ebb8917c7bbc623a1 100644 (file)
@@ -72,7 +72,7 @@ public class IssueQueryFactoryTest {
       .setStatuses(asList("CLOSED"))
       .setResolutions(asList("FALSE-POSITIVE"))
       .setResolved(true)
-      .setProjectKeys(asList(project.key()))
+      .setProjectKeys(asList(project.getDbKey()))
       .setModuleUuids(asList(module.uuid()))
       .setDirectories(asList("aDirPath"))
       .setFileUuids(asList(file.uuid()))
@@ -183,7 +183,7 @@ public class IssueQueryFactoryTest {
     ComponentDto project = db.components().insertPrivateProject();
     ComponentDto file = db.components().insertComponent(ComponentTesting.newFileDto(project));
     SearchWsRequest request = new SearchWsRequest()
-      .setComponentRoots(asList(project.key(), file.key()));
+      .setComponentRoots(asList(project.getDbKey(), file.getDbKey()));
 
     expectedException.expect(IllegalArgumentException.class);
     expectedException.expectMessage("All components must have the same qualifier, found FIL,TRK");
@@ -269,7 +269,7 @@ public class IssueQueryFactoryTest {
   public void onComponentOnly_restricts_search_to_specified_componentKeys() {
     ComponentDto project = db.components().insertPrivateProject();
     SearchWsRequest request = new SearchWsRequest()
-      .setComponentKeys(asList(project.key()))
+      .setComponentKeys(asList(project.getDbKey()))
       .setOnComponentOnly(true);
 
     IssueQuery query = underTest.create(request);
index f9ec6b8d7b69a70999c4b650ce5baca52f024894..ce7fd1dc7629bc85ab85b72c29d14ee3addc3244 100644 (file)
@@ -114,9 +114,9 @@ public class IssueUpdaterTest {
     assertThat(issueChangeNotification.getFieldValue("key")).isEqualTo(issue.key());
     assertThat(issueChangeNotification.getFieldValue("old.severity")).isEqualTo(MAJOR);
     assertThat(issueChangeNotification.getFieldValue("new.severity")).isEqualTo(BLOCKER);
-    assertThat(issueChangeNotification.getFieldValue("componentKey")).isEqualTo(file.key());
+    assertThat(issueChangeNotification.getFieldValue("componentKey")).isEqualTo(file.getDbKey());
     assertThat(issueChangeNotification.getFieldValue("componentName")).isEqualTo(file.longName());
-    assertThat(issueChangeNotification.getFieldValue("projectKey")).isEqualTo(project.key());
+    assertThat(issueChangeNotification.getFieldValue("projectKey")).isEqualTo(project.getDbKey());
     assertThat(issueChangeNotification.getFieldValue("projectName")).isEqualTo(project.name());
     assertThat(issueChangeNotification.getFieldValue("ruleName")).isEqualTo(rule.getName());
     assertThat(issueChangeNotification.getFieldValue("changeAuthor")).isEqualTo("john");
index 48194e6b71a95e77e64b6c471acdd9569d3f5adf..d24a40a3dbd6af91916b32f491011a146d5281ed 100644 (file)
@@ -1105,7 +1105,7 @@ public class IssueIndexTest {
 
     userSessionRule.logIn(user1);
     assertThatSearchReturnsOnly(IssueQuery.builder(), "I1");
-    assertThatSearchReturnsEmpty(IssueQuery.builder().projectUuids(asList(project3.key())));
+    assertThatSearchReturnsEmpty(IssueQuery.builder().projectUuids(asList(project3.getDbKey())));
 
     userSessionRule.logIn(user2);
     assertThatSearchReturnsOnly(IssueQuery.builder(), "I2");
index 2a2d26462664db3dcb9f1fdfd398a947924dfe68..0d02dcbd8cd1e1eebc2aca36f80d7b4c52598b1a 100644 (file)
@@ -92,7 +92,7 @@ public class IssueChangeNotificationTest {
 
   @Test
   public void set_component() {
-    IssueChangeNotification result = notification.setComponent(new ComponentDto().setKey("MyService").setLongName("My Service"));
+    IssueChangeNotification result = notification.setComponent(new ComponentDto().setDbKey("MyService").setLongName("My Service"));
     assertThat(result.getFieldValue("componentName")).isEqualTo("My Service");
   }
 
index f8416a37848bf31c50cd2b74f32c04c8d4a765e2..42d036f3e048b2f828d27556e3ba6ea8b39da004 100644 (file)
@@ -254,7 +254,7 @@ public class BulkChangeActionTest {
     assertThat(issueChangeNotificationCaptor.getValue().getFieldValue("key")).isEqualTo(issueDto.getKey());
     assertThat(issueChangeNotificationCaptor.getValue().getFieldValue("componentName")).isEqualTo(file.longName());
     assertThat(issueChangeNotificationCaptor.getValue().getFieldValue("projectName")).isEqualTo(project.longName());
-    assertThat(issueChangeNotificationCaptor.getValue().getFieldValue("projectKey")).isEqualTo(project.key());
+    assertThat(issueChangeNotificationCaptor.getValue().getFieldValue("projectKey")).isEqualTo(project.getDbKey());
     assertThat(issueChangeNotificationCaptor.getValue().getFieldValue("ruleName")).isEqualTo(rule.getName());
     assertThat(issueChangeNotificationCaptor.getValue().getFieldValue("changeAuthor")).isEqualTo(user.getLogin());
   }
index 52df082d7bd5dc2614790aeed321e89a33ee7545..fea4cd566c622a88a8dc6c858b0deddcb349d172 100644 (file)
@@ -110,8 +110,8 @@ public class SearchActionComponentsMediumTest {
   @Test
   public void issues_on_different_projects() throws Exception {
     RuleDto rule = newRule();
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization1, "P1").setKey("PK1"));
-    ComponentDto file = insertComponent(newFileDto(project, null, "F1").setKey("FK1"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization1, "P1").setDbKey("PK1"));
+    ComponentDto file = insertComponent(newFileDto(project, null, "F1").setDbKey("FK1"));
     IssueDto issue = IssueTesting.newDto(rule, file, project)
       .setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2")
       .setStatus("OPEN").setResolution("OPEN")
@@ -120,8 +120,8 @@ public class SearchActionComponentsMediumTest {
       .setIssueUpdateDate(DateUtils.parseDateTime("2017-12-04T00:00:00+0100"));
     db.issueDao().insert(session, issue);
 
-    ComponentDto project2 = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization2, "P2").setKey("PK2"));
-    ComponentDto file2 = insertComponent(newFileDto(project2, null, "F2").setKey("FK2"));
+    ComponentDto project2 = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization2, "P2").setDbKey("PK2"));
+    ComponentDto file2 = insertComponent(newFileDto(project2, null, "F2").setDbKey("FK2"));
     IssueDto issue2 = IssueTesting.newDto(rule, file2, project2)
       .setKee("92fd47d4-b650-4037-80bc-7b112bd4eac2")
       .setStatus("OPEN").setResolution("OPEN")
@@ -139,9 +139,9 @@ public class SearchActionComponentsMediumTest {
 
   @Test
   public void do_not_return_module_key_on_single_module_projects() throws IOException {
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(defaultOrganization, "P1").setKey("PK1"));
-    ComponentDto module = insertComponent(newModuleDto("M1", project).setKey("MK1"));
-    ComponentDto file = insertComponent(newFileDto(module, null, "F1").setKey("FK1"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(defaultOrganization, "P1").setDbKey("PK1"));
+    ComponentDto module = insertComponent(newModuleDto("M1", project).setDbKey("MK1"));
+    ComponentDto file = insertComponent(newFileDto(module, null, "F1").setDbKey("FK1"));
     RuleDto newRule = newRule();
     IssueDto issueInModule = IssueTesting.newDto(newRule, file, project).setKee("ISSUE_IN_MODULE");
     IssueDto issueInRootModule = IssueTesting.newDto(newRule, project, project).setKee("ISSUE_IN_ROOT_MODULE");
@@ -166,8 +166,8 @@ public class SearchActionComponentsMediumTest {
 
   @Test
   public void search_by_project_uuid() throws Exception {
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization1, "P1").setKey("PK1"));
-    ComponentDto file = insertComponent(newFileDto(project, null, "F1").setKey("FK1"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization1, "P1").setDbKey("PK1"));
+    ComponentDto file = insertComponent(newFileDto(project, null, "F1").setDbKey("FK1"));
     IssueDto issue = IssueTesting.newDto(newRule(), file, project).setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2");
     db.issueDao().insert(session, issue);
     session.commit();
@@ -197,8 +197,8 @@ public class SearchActionComponentsMediumTest {
 
   @Test
   public void search_since_leak_period_on_project() throws Exception {
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization2, "P1").setKey("PK1"));
-    ComponentDto file = insertComponent(newFileDto(project, null, "F1").setKey("FK1"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization2, "P1").setDbKey("PK1"));
+    ComponentDto file = insertComponent(newFileDto(project, null, "F1").setDbKey("FK1"));
     db.snapshotDao().insert(session,
       newAnalysis(project)
         .setPeriodDate(parseDateTime("2015-09-03T00:00:00+0100").getTime()));
@@ -225,9 +225,9 @@ public class SearchActionComponentsMediumTest {
 
   @Test
   public void search_since_leak_period_on_file_in_module_project() throws Exception {
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(defaultOrganization, "P1").setKey("PK1"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(defaultOrganization, "P1").setDbKey("PK1"));
     ComponentDto module = insertComponent(newModuleDto(project));
-    ComponentDto file = insertComponent(newFileDto(module, null, "F1").setKey("FK1"));
+    ComponentDto file = insertComponent(newFileDto(module, null, "F1").setDbKey("FK1"));
     db.snapshotDao().insert(session,
       newAnalysis(project).setPeriodDate(parseDateTime("2015-09-03T00:00:00+0100").getTime()));
     RuleDto rule = newRule();
@@ -254,12 +254,12 @@ public class SearchActionComponentsMediumTest {
 
   @Test
   public void project_facet_is_sticky() throws Exception {
-    ComponentDto project1 = insertComponent(ComponentTesting.newPublicProjectDto(defaultOrganization, "P1").setKey("PK1"));
-    ComponentDto project2 = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization1, "P2").setKey("PK2"));
-    ComponentDto project3 = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization2, "P3").setKey("PK3"));
-    ComponentDto file1 = insertComponent(newFileDto(project1, null, "F1").setKey("FK1"));
-    ComponentDto file2 = insertComponent(newFileDto(project2, null, "F2").setKey("FK2"));
-    ComponentDto file3 = insertComponent(newFileDto(project3, null, "F3").setKey("FK3"));
+    ComponentDto project1 = insertComponent(ComponentTesting.newPublicProjectDto(defaultOrganization, "P1").setDbKey("PK1"));
+    ComponentDto project2 = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization1, "P2").setDbKey("PK2"));
+    ComponentDto project3 = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization2, "P3").setDbKey("PK3"));
+    ComponentDto file1 = insertComponent(newFileDto(project1, null, "F1").setDbKey("FK1"));
+    ComponentDto file2 = insertComponent(newFileDto(project2, null, "F2").setDbKey("FK2"));
+    ComponentDto file3 = insertComponent(newFileDto(project3, null, "F3").setDbKey("FK3"));
     RuleDto rule = newRule();
     IssueDto issue1 = IssueTesting.newDto(rule, file1, project1).setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2");
     IssueDto issue2 = IssueTesting.newDto(rule, file2, project2).setKee("2bd4eac2-b650-4037-80bc-7b1182fd47d4");
@@ -278,8 +278,8 @@ public class SearchActionComponentsMediumTest {
 
   @Test
   public void search_by_file_uuid() throws Exception {
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(defaultOrganization, "P1").setKey("PK1"));
-    ComponentDto file = insertComponent(newFileDto(project, null, "F1").setKey("FK1"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(defaultOrganization, "P1").setDbKey("PK1"));
+    ComponentDto file = insertComponent(newFileDto(project, null, "F1").setDbKey("FK1"));
     IssueDto issue = IssueTesting.newDto(newRule(), file, project).setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2");
     db.issueDao().insert(session, issue);
     session.commit();
@@ -309,9 +309,9 @@ public class SearchActionComponentsMediumTest {
 
   @Test
   public void search_by_file_key() throws Exception {
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization1, "P1").setKey("PK1"));
-    ComponentDto file = insertComponent(newFileDto(project, null, "F1").setKey("FK1"));
-    ComponentDto unitTest = insertComponent(newFileDto(project, null, "F2").setQualifier(Qualifiers.UNIT_TEST_FILE).setKey("FK2"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization1, "P1").setDbKey("PK1"));
+    ComponentDto file = insertComponent(newFileDto(project, null, "F1").setDbKey("FK1"));
+    ComponentDto unitTest = insertComponent(newFileDto(project, null, "F2").setQualifier(Qualifiers.UNIT_TEST_FILE).setDbKey("FK2"));
     RuleDto rule = newRule();
     IssueDto issueOnFile = IssueTesting.newDto(rule, file, project).setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2");
     IssueDto issueOnTest = IssueTesting.newDto(rule, unitTest, project).setKee("2bd4eac2-b650-4037-80bc-7b1182fd47d4");
@@ -321,22 +321,22 @@ public class SearchActionComponentsMediumTest {
     indexPermissions();
 
     wsTester.newGetRequest(CONTROLLER_ISSUES, ACTION_SEARCH)
-      .setParam(IssuesWsParameters.PARAM_COMPONENTS, file.key())
+      .setParam(IssuesWsParameters.PARAM_COMPONENTS, file.getDbKey())
       .execute()
       .assertJson(this.getClass(), "search_by_file_key.json");
 
     wsTester.newGetRequest(CONTROLLER_ISSUES, ACTION_SEARCH)
-      .setParam(IssuesWsParameters.PARAM_COMPONENTS, unitTest.key())
+      .setParam(IssuesWsParameters.PARAM_COMPONENTS, unitTest.getDbKey())
       .execute()
       .assertJson(this.getClass(), "search_by_test_key.json");
   }
 
   @Test
   public void display_file_facet() throws Exception {
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization2, "P1").setKey("PK1"));
-    ComponentDto file1 = insertComponent(newFileDto(project, null, "F1").setKey("FK1"));
-    ComponentDto file2 = insertComponent(newFileDto(project, null, "F2").setKey("FK2"));
-    ComponentDto file3 = insertComponent(newFileDto(project, null, "F3").setKey("FK3"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization2, "P1").setDbKey("PK1"));
+    ComponentDto file1 = insertComponent(newFileDto(project, null, "F1").setDbKey("FK1"));
+    ComponentDto file2 = insertComponent(newFileDto(project, null, "F2").setDbKey("FK2"));
+    ComponentDto file3 = insertComponent(newFileDto(project, null, "F3").setDbKey("FK3"));
     RuleDto newRule = newRule();
     IssueDto issue1 = IssueTesting.newDto(newRule, file1, project).setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2");
     IssueDto issue2 = IssueTesting.newDto(newRule, file2, project).setKee("2bd4eac2-b650-4037-80bc-7b1182fd47d4");
@@ -355,9 +355,9 @@ public class SearchActionComponentsMediumTest {
 
   @Test
   public void search_by_directory_path() throws Exception {
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(defaultOrganization, "P1").setKey("PK1"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(defaultOrganization, "P1").setDbKey("PK1"));
     ComponentDto directory = insertComponent(ComponentTesting.newDirectory(project, "D1", "src/main/java/dir"));
-    ComponentDto file = insertComponent(newFileDto(project, null, "F1").setKey("FK1").setPath(directory.path() + "/MyComponent.java"));
+    ComponentDto file = insertComponent(newFileDto(project, null, "F1").setDbKey("FK1").setPath(directory.path() + "/MyComponent.java"));
     IssueDto issue = IssueTesting.newDto(newRule(), file, project).setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2");
     db.issueDao().insert(session, issue);
     session.commit();
@@ -387,13 +387,13 @@ public class SearchActionComponentsMediumTest {
 
   @Test
   public void search_by_directory_path_in_different_modules() throws Exception {
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization1, "P1").setKey("PK1"));
-    ComponentDto module1 = insertComponent(newModuleDto("M1", project).setKey("MK1"));
-    ComponentDto module2 = insertComponent(newModuleDto("M2", project).setKey("MK2"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization1, "P1").setDbKey("PK1"));
+    ComponentDto module1 = insertComponent(newModuleDto("M1", project).setDbKey("MK1"));
+    ComponentDto module2 = insertComponent(newModuleDto("M2", project).setDbKey("MK2"));
     ComponentDto directory1 = insertComponent(ComponentTesting.newDirectory(module1, "D1", "src/main/java/dir"));
     ComponentDto directory2 = insertComponent(ComponentTesting.newDirectory(module2, "D2", "src/main/java/dir"));
-    ComponentDto file1 = insertComponent(newFileDto(module1, directory1, "F1").setKey("FK1").setPath(directory1.path() + "/MyComponent.java"));
-    insertComponent(newFileDto(module2, directory2, "F2").setKey("FK2").setPath(directory2.path() + "/MyComponent.java"));
+    ComponentDto file1 = insertComponent(newFileDto(module1, directory1, "F1").setDbKey("FK1").setPath(directory1.path() + "/MyComponent.java"));
+    insertComponent(newFileDto(module2, directory2, "F2").setDbKey("FK2").setPath(directory2.path() + "/MyComponent.java"));
     RuleDto rule = newRule();
     IssueDto issue1 = IssueTesting.newDto(rule, file1, project).setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2");
     db.issueDao().insert(session, issue1);
@@ -436,13 +436,13 @@ public class SearchActionComponentsMediumTest {
 
   @Test
   public void display_module_facet() throws Exception {
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization2, "P1").setKey("PK1"));
-    ComponentDto module = insertComponent(newModuleDto("M1", project).setKey("MK1"));
-    ComponentDto subModule1 = insertComponent(newModuleDto("SUBM1", module).setKey("SUBMK1"));
-    ComponentDto subModule2 = insertComponent(newModuleDto("SUBM2", module).setKey("SUBMK2"));
-    ComponentDto subModule3 = insertComponent(newModuleDto("SUBM3", module).setKey("SUBMK3"));
-    ComponentDto file1 = insertComponent(newFileDto(subModule1, null, "F1").setKey("FK1"));
-    ComponentDto file2 = insertComponent(newFileDto(subModule2, null, "F2").setKey("FK2"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization2, "P1").setDbKey("PK1"));
+    ComponentDto module = insertComponent(newModuleDto("M1", project).setDbKey("MK1"));
+    ComponentDto subModule1 = insertComponent(newModuleDto("SUBM1", module).setDbKey("SUBMK1"));
+    ComponentDto subModule2 = insertComponent(newModuleDto("SUBM2", module).setDbKey("SUBMK2"));
+    ComponentDto subModule3 = insertComponent(newModuleDto("SUBM3", module).setDbKey("SUBMK3"));
+    ComponentDto file1 = insertComponent(newFileDto(subModule1, null, "F1").setDbKey("FK1"));
+    ComponentDto file2 = insertComponent(newFileDto(subModule2, null, "F2").setDbKey("FK2"));
     RuleDto newRule = newRule();
     IssueDto issue1 = IssueTesting.newDto(newRule, file1, project).setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2");
     IssueDto issue2 = IssueTesting.newDto(newRule, file2, project).setKee("2bd4eac2-b650-4037-80bc-7b1182fd47d4");
@@ -461,9 +461,9 @@ public class SearchActionComponentsMediumTest {
 
   @Test
   public void display_directory_facet() throws Exception {
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(defaultOrganization, "P1").setKey("PK1"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(defaultOrganization, "P1").setDbKey("PK1"));
     ComponentDto directory = insertComponent(ComponentTesting.newDirectory(project, "D1", "src/main/java/dir"));
-    ComponentDto file = insertComponent(newFileDto(project, directory, "F1").setKey("FK1").setPath(directory.path() + "/MyComponent.java"));
+    ComponentDto file = insertComponent(newFileDto(project, directory, "F1").setDbKey("FK1").setPath(directory.path() + "/MyComponent.java"));
     IssueDto issue = IssueTesting.newDto(newRule(), file, project).setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2");
     db.issueDao().insert(session, issue);
     session.commit();
@@ -480,9 +480,9 @@ public class SearchActionComponentsMediumTest {
 
   @Test
   public void search_by_view_uuid() throws Exception {
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization1, "P1").setKey("PK1"));
-    ComponentDto file = insertComponent(newFileDto(project, null, "F1").setKey("FK1"));
-    ComponentDto view = insertComponent(ComponentTesting.newView(defaultOrganization, "V1").setKey("MyView"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization1, "P1").setDbKey("PK1"));
+    ComponentDto file = insertComponent(newFileDto(project, null, "F1").setDbKey("FK1"));
+    ComponentDto view = insertComponent(ComponentTesting.newView(defaultOrganization, "V1").setDbKey("MyView"));
     indexView(view.uuid(), newArrayList(project.uuid()));
     indexPermissions();
 
@@ -499,11 +499,11 @@ public class SearchActionComponentsMediumTest {
 
   @Test
   public void search_by_sub_view_uuid() throws Exception {
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(defaultOrganization, "P1").setKey("PK1"));
-    ComponentDto file = insertComponent(newFileDto(project, null, "F1").setKey("FK1"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(defaultOrganization, "P1").setDbKey("PK1"));
+    ComponentDto file = insertComponent(newFileDto(project, null, "F1").setDbKey("FK1"));
     insertIssue(IssueTesting.newDto(newRule(), file, project).setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2"));
 
-    ComponentDto view = insertComponent(ComponentTesting.newView(otherOrganization1, "V1").setKey("MyView"));
+    ComponentDto view = insertComponent(ComponentTesting.newView(otherOrganization1, "V1").setDbKey("MyView"));
     indexView(view.uuid(), newArrayList(project.uuid()));
     ComponentDto subView = insertComponent(ComponentTesting.newSubView(view, "SV1", "MySubView"));
     indexView(subView.uuid(), newArrayList(project.uuid()));
@@ -519,11 +519,11 @@ public class SearchActionComponentsMediumTest {
 
   @Test
   public void search_by_sub_view_uuid_return_only_authorized_view() throws Exception {
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(defaultOrganization, "P1").setKey("PK1"));
-    ComponentDto file = insertComponent(newFileDto(project, null, "F1").setKey("FK1"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(defaultOrganization, "P1").setDbKey("PK1"));
+    ComponentDto file = insertComponent(newFileDto(project, null, "F1").setDbKey("FK1"));
     insertIssue(IssueTesting.newDto(newRule(), file, project).setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2"));
 
-    ComponentDto view = insertComponent(ComponentTesting.newView(otherOrganization1, "V1").setKey("MyView"));
+    ComponentDto view = insertComponent(ComponentTesting.newView(otherOrganization1, "V1").setDbKey("MyView"));
     indexView(view.uuid(), newArrayList(project.uuid()));
     ComponentDto subView = insertComponent(ComponentTesting.newSubView(view, "SV1", "MySubView"));
     indexView(subView.uuid(), newArrayList(project.uuid()));
@@ -540,8 +540,8 @@ public class SearchActionComponentsMediumTest {
 
   @Test
   public void search_by_author() throws Exception {
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(defaultOrganization, "P1").setKey("PK1"));
-    ComponentDto file = insertComponent(newFileDto(project, null, "F1").setKey("FK1"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(defaultOrganization, "P1").setDbKey("PK1"));
+    ComponentDto file = insertComponent(newFileDto(project, null, "F1").setDbKey("FK1"));
     RuleDto newRule = newRule();
     IssueDto issue1 = IssueTesting.newDto(newRule, file, project).setAuthorLogin("leia").setKee("2bd4eac2-b650-4037-80bc-7b112bd4eac2");
     IssueDto issue2 = IssueTesting.newDto(newRule, file, project).setAuthorLogin("luke@skywalker.name").setKee("82fd47d4-b650-4037-80bc-7b1182fd47d4");
index 7fc36cb2b3ea12f376072b2f8531b6c35b3d72ed..753ec3dc75ce3103226d4eb282ef1e48509a89bf 100644 (file)
@@ -92,7 +92,7 @@ public class SearchActionComponentsTest {
     indexIssuesAndViews();
 
     SearchWsResponse result = ws.newRequest()
-      .setParam(PARAM_COMPONENT_KEYS, application.getKey())
+      .setParam(PARAM_COMPONENT_KEYS, application.getDbKey())
       .executeProtobuf(SearchWsResponse.class);
 
     assertThat(result.getIssuesList()).extracting(Issue::getKey)
@@ -110,7 +110,7 @@ public class SearchActionComponentsTest {
     indexIssuesAndViews();
 
     SearchWsResponse result = ws.newRequest()
-      .setParam(PARAM_COMPONENT_KEYS, application.getKey())
+      .setParam(PARAM_COMPONENT_KEYS, application.getDbKey())
       .executeProtobuf(SearchWsResponse.class);
 
     assertThat(result.getIssuesList()).isEmpty();
@@ -126,7 +126,7 @@ public class SearchActionComponentsTest {
     indexIssuesAndViews();
 
     SearchWsResponse result = ws.newRequest()
-      .setParam(PARAM_COMPONENT_KEYS, application.getKey())
+      .setParam(PARAM_COMPONENT_KEYS, application.getDbKey())
       .executeProtobuf(SearchWsResponse.class);
 
     assertThat(result.getIssuesList()).isEmpty();
@@ -155,7 +155,7 @@ public class SearchActionComponentsTest {
     indexIssuesAndViews();
 
     SearchWsResponse result = ws.newRequest()
-      .setParam(PARAM_COMPONENT_KEYS, application.getKey())
+      .setParam(PARAM_COMPONENT_KEYS, application.getDbKey())
       .setParam(PARAM_SINCE_LEAK_PERIOD, "true")
       .executeProtobuf(SearchWsResponse.class);
 
@@ -179,8 +179,8 @@ public class SearchActionComponentsTest {
     indexIssuesAndViews();
 
     SearchWsResponse result = ws.newRequest()
-      .setParam(PARAM_COMPONENT_KEYS, application.getKey())
-      .setParam(PARAM_PROJECT_KEYS, project1.getKey())
+      .setParam(PARAM_COMPONENT_KEYS, application.getDbKey())
+      .setParam(PARAM_PROJECT_KEYS, project1.getDbKey())
       .executeProtobuf(SearchWsResponse.class);
 
     assertThat(result.getIssuesList()).extracting(Issue::getKey)
@@ -211,8 +211,8 @@ public class SearchActionComponentsTest {
     indexIssuesAndViews();
 
     SearchWsResponse result = ws.newRequest()
-      .setParam(PARAM_COMPONENT_KEYS, application.getKey())
-      .setParam(PARAM_PROJECT_KEYS, project1.getKey())
+      .setParam(PARAM_COMPONENT_KEYS, application.getDbKey())
+      .setParam(PARAM_PROJECT_KEYS, project1.getDbKey())
       .setParam(PARAM_SINCE_LEAK_PERIOD, "true")
       .executeProtobuf(SearchWsResponse.class);
 
@@ -244,7 +244,7 @@ public class SearchActionComponentsTest {
     indexIssuesAndViews();
 
     SearchWsResponse result = ws.newRequest()
-      .setParam(PARAM_COMPONENT_KEYS, application.getKey())
+      .setParam(PARAM_COMPONENT_KEYS, application.getDbKey())
       .setParam(PARAM_SINCE_LEAK_PERIOD, "true")
       .executeProtobuf(SearchWsResponse.class);
 
index 331e487caef40efeabbd3b8dfeebe1b4cc6c10e7..96ec1feaf06858b135d41cac0f8ba12364a80dc3 100644 (file)
@@ -122,9 +122,9 @@ public class SearchActionMediumTest {
     db.userDao().insert(session, new UserDto().setLogin("simon").setName("Simon").setEmail("simon@email.com"));
     db.userDao().insert(session, new UserDto().setLogin("fabrice").setName("Fabrice").setEmail("fabrice@email.com"));
 
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization2, "PROJECT_ID").setKey("PROJECT_KEY"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization2, "PROJECT_ID").setDbKey("PROJECT_KEY"));
     indexPermissions();
-    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setKey("FILE_KEY"));
+    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setDbKey("FILE_KEY"));
     IssueDto issue = IssueTesting.newDto(newRule(), file, project)
       .setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2")
       .setEffort(10L)
@@ -151,9 +151,9 @@ public class SearchActionMediumTest {
     db.userDao().insert(session, new UserDto().setLogin("john").setName("John"));
     db.userDao().insert(session, new UserDto().setLogin("fabrice").setName("Fabrice").setEmail("fabrice@email.com"));
 
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization2, "PROJECT_ID").setKey("PROJECT_KEY"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization2, "PROJECT_ID").setDbKey("PROJECT_KEY"));
     indexPermissions();
-    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setKey("FILE_KEY"));
+    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setDbKey("FILE_KEY"));
     IssueDto issue = IssueTesting.newDto(newRule(), file, project)
       .setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2");
     db.issueDao().insert(session, issue);
@@ -188,9 +188,9 @@ public class SearchActionMediumTest {
     db.userDao().insert(session, new UserDto().setLogin("john").setName("John").setEmail("john@email.com"));
     db.userDao().insert(session, new UserDto().setLogin("fabrice").setName("Fabrice").setEmail("fabrice@email.com"));
 
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization1, "PROJECT_ID").setKey("PROJECT_KEY"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization1, "PROJECT_ID").setDbKey("PROJECT_KEY"));
     indexPermissions();
-    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setKey("FILE_KEY"));
+    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setDbKey("FILE_KEY"));
     IssueDto issue = IssueTesting.newDto(newRule(), file, project)
       .setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2");
     db.issueDao().insert(session, issue);
@@ -223,9 +223,9 @@ public class SearchActionMediumTest {
   public void load_additional_fields() throws Exception {
     db.userDao().insert(session, new UserDto().setLogin("simon").setName("Simon").setEmail("simon@email.com"));
     db.userDao().insert(session, new UserDto().setLogin("fabrice").setName("Fabrice").setEmail("fabrice@email.com"));
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization2, "PROJECT_ID").setKey("PROJECT_KEY").setLanguage("java"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization2, "PROJECT_ID").setDbKey("PROJECT_KEY").setLanguage("java"));
     indexPermissions();
-    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setKey("FILE_KEY").setLanguage("js"));
+    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setDbKey("FILE_KEY").setLanguage("js"));
 
     IssueDto issue = IssueTesting.newDto(newRule(), file, project)
       .setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2")
@@ -246,10 +246,10 @@ public class SearchActionMediumTest {
   public void load_additional_fields_with_issue_admin_permission() throws Exception {
     db.userDao().insert(session, new UserDto().setLogin("simon").setName("Simon").setEmail("simon@email.com"));
     db.userDao().insert(session, new UserDto().setLogin("fabrice").setName("Fabrice").setEmail("fabrice@email.com"));
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization1, "PROJECT_ID").setKey("PROJECT_KEY").setLanguage("java"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization1, "PROJECT_ID").setDbKey("PROJECT_KEY").setLanguage("java"));
     grantPermissionToAnyone(project, ISSUE_ADMIN);
     indexPermissions();
-    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setKey("FILE_KEY").setLanguage("js"));
+    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setDbKey("FILE_KEY").setLanguage("js"));
 
     IssueDto issue = IssueTesting.newDto(newRule(), file, project)
       .setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2")
@@ -270,10 +270,10 @@ public class SearchActionMediumTest {
   @Test
   public void issue_on_removed_file() throws Exception {
     RuleDto rule = newRule();
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization2, "PROJECT_ID").setKey("PROJECT_KEY"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization2, "PROJECT_ID").setDbKey("PROJECT_KEY"));
     indexPermissions();
     ComponentDto removedFile = insertComponent(ComponentTesting.newFileDto(project, null).setUuid("REMOVED_FILE_ID")
-      .setKey("REMOVED_FILE_KEY")
+      .setDbKey("REMOVED_FILE_KEY")
       .setEnabled(false));
 
     IssueDto issue = IssueTesting.newDto(rule, removedFile, project)
@@ -296,9 +296,9 @@ public class SearchActionMediumTest {
   @Test
   public void apply_paging_with_one_component() throws Exception {
     RuleDto rule = newRule();
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization2, "PROJECT_ID").setKey("PROJECT_KEY"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization2, "PROJECT_ID").setDbKey("PROJECT_KEY"));
     indexPermissions();
-    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setKey("FILE_KEY"));
+    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setDbKey("FILE_KEY"));
     for (int i = 0; i < SearchOptions.MAX_LIMIT + 1; i++) {
       IssueDto issue = IssueTesting.newDto(rule, file, project);
       tester.get(IssueDao.class).insert(session, issue);
@@ -307,16 +307,16 @@ public class SearchActionMediumTest {
     IssueIndexer r = tester.get(IssueIndexer.class);
     r.indexOnStartup(r.getIndexTypes());
 
-    WsTester.Result result = wsTester.newGetRequest(CONTROLLER_ISSUES, ACTION_SEARCH).setParam(PARAM_COMPONENTS, file.getKey()).execute();
+    WsTester.Result result = wsTester.newGetRequest(CONTROLLER_ISSUES, ACTION_SEARCH).setParam(PARAM_COMPONENTS, file.getDbKey()).execute();
     result.assertJson(this.getClass(), "apply_paging_with_one_component.json");
   }
 
   @Test
   public void components_contains_sub_projects() throws Exception {
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization1, "PROJECT_ID").setKey("ProjectHavingModule"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization1, "PROJECT_ID").setDbKey("ProjectHavingModule"));
     indexPermissions();
-    ComponentDto module = insertComponent(ComponentTesting.newModuleDto(project).setKey("ModuleHavingFile"));
-    ComponentDto file = insertComponent(ComponentTesting.newFileDto(module, null, "BCDE").setKey("FileLinkedToModule"));
+    ComponentDto module = insertComponent(ComponentTesting.newModuleDto(project).setDbKey("ModuleHavingFile"));
+    ComponentDto file = insertComponent(ComponentTesting.newFileDto(module, null, "BCDE").setDbKey("FileLinkedToModule"));
     IssueDto issue = IssueTesting.newDto(newRule(), file, project);
     db.issueDao().insert(session, issue);
     session.commit();
@@ -329,9 +329,9 @@ public class SearchActionMediumTest {
 
   @Test
   public void display_facets() throws Exception {
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization1, "PROJECT_ID").setKey("PROJECT_KEY"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization1, "PROJECT_ID").setDbKey("PROJECT_KEY"));
     indexPermissions();
-    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setKey("FILE_KEY"));
+    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setDbKey("FILE_KEY"));
     IssueDto issue = IssueTesting.newDto(newRule(), file, project)
       .setIssueCreationDate(DateUtils.parseDate("2014-09-04"))
       .setIssueUpdateDate(DateUtils.parseDate("2017-12-04"))
@@ -354,9 +354,9 @@ public class SearchActionMediumTest {
 
   @Test
   public void display_facets_in_effort_mode() throws Exception {
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization2, "PROJECT_ID").setKey("PROJECT_KEY"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization2, "PROJECT_ID").setDbKey("PROJECT_KEY"));
     indexPermissions();
-    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setKey("FILE_KEY"));
+    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setDbKey("FILE_KEY"));
     IssueDto issue = IssueTesting.newDto(newRule(), file, project)
       .setIssueCreationDate(DateUtils.parseDate("2014-09-04"))
       .setIssueUpdateDate(DateUtils.parseDate("2017-12-04"))
@@ -380,9 +380,9 @@ public class SearchActionMediumTest {
 
   @Test
   public void display_zero_valued_facets_for_selected_items() throws Exception {
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization1, "PROJECT_ID").setKey("PROJECT_KEY"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization1, "PROJECT_ID").setDbKey("PROJECT_KEY"));
     indexPermissions();
-    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setKey("FILE_KEY"));
+    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setDbKey("FILE_KEY"));
     IssueDto issue = IssueTesting.newDto(newRule(), file, project)
       .setIssueCreationDate(DateUtils.parseDate("2014-09-04"))
       .setIssueUpdateDate(DateUtils.parseDate("2017-12-04"))
@@ -422,9 +422,9 @@ public class SearchActionMediumTest {
   public void filter_by_assigned_to_me() throws Exception {
     db.userDao().insert(session, new UserDto().setLogin("john").setName("John").setEmail("john@email.com"));
 
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(defaultOrganization, "PROJECT_ID").setKey("PROJECT_KEY"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(defaultOrganization, "PROJECT_ID").setDbKey("PROJECT_KEY"));
     indexPermissions();
-    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setKey("FILE_KEY"));
+    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setDbKey("FILE_KEY"));
     RuleDto rule = newRule();
     IssueDto issue1 = IssueTesting.newDto(rule, file, project)
       .setIssueCreationDate(DateUtils.parseDate("2014-09-04"))
@@ -467,9 +467,9 @@ public class SearchActionMediumTest {
   public void filter_by_assigned_to_me_unauthenticated() throws Exception {
     userSessionRule.logIn();
 
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization1, "PROJECT_ID").setKey("PROJECT_KEY"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization1, "PROJECT_ID").setDbKey("PROJECT_KEY"));
     indexPermissions();
-    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setKey("FILE_KEY"));
+    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setDbKey("FILE_KEY"));
     RuleDto rule = newRule();
     IssueDto issue1 = IssueTesting.newDto(rule, file, project)
       .setStatus("OPEN")
@@ -498,9 +498,9 @@ public class SearchActionMediumTest {
   public void assigned_to_me_facet_is_sticky_relative_to_assignees() throws Exception {
     db.userDao().insert(session, new UserDto().setLogin("alice").setName("Alice").setEmail("alice@email.com"));
 
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization2, "PROJECT_ID").setKey("PROJECT_KEY"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization2, "PROJECT_ID").setDbKey("PROJECT_KEY"));
     indexPermissions();
-    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setKey("FILE_KEY"));
+    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setDbKey("FILE_KEY"));
     RuleDto rule = newRule();
     IssueDto issue1 = IssueTesting.newDto(rule, file, project)
       .setIssueCreationDate(DateUtils.parseDate("2014-09-04"))
@@ -542,9 +542,9 @@ public class SearchActionMediumTest {
   @Test
   public void sort_by_updated_at() throws Exception {
     RuleDto rule = newRule();
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization2, "PROJECT_ID").setKey("PROJECT_KEY"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization2, "PROJECT_ID").setDbKey("PROJECT_KEY"));
     indexPermissions();
-    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setKey("FILE_KEY"));
+    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setDbKey("FILE_KEY"));
     db.issueDao().insert(session, IssueTesting.newDto(rule, file, project)
       .setKee("82fd47d4-b650-4037-80bc-7b112bd4eac1")
       .setIssueUpdateDate(DateUtils.parseDateTime("2014-11-02T00:00:00+0100")));
@@ -568,9 +568,9 @@ public class SearchActionMediumTest {
   @Test
   public void paging() throws Exception {
     RuleDto rule = newRule();
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization1, "PROJECT_ID").setKey("PROJECT_KEY"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization1, "PROJECT_ID").setDbKey("PROJECT_KEY"));
     indexPermissions();
-    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setKey("FILE_KEY"));
+    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setDbKey("FILE_KEY"));
     for (int i = 0; i < 12; i++) {
       IssueDto issue = IssueTesting.newDto(rule, file, project);
       tester.get(IssueDao.class).insert(session, issue);
@@ -590,9 +590,9 @@ public class SearchActionMediumTest {
   @Test
   public void paging_with_page_size_to_minus_one() throws Exception {
     RuleDto rule = newRule();
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization2, "PROJECT_ID").setKey("PROJECT_KEY"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization2, "PROJECT_ID").setDbKey("PROJECT_KEY"));
     indexPermissions();
-    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setKey("FILE_KEY"));
+    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setDbKey("FILE_KEY"));
     for (int i = 0; i < 12; i++) {
       IssueDto issue = IssueTesting.newDto(rule, file, project);
       tester.get(IssueDao.class).insert(session, issue);
@@ -612,9 +612,9 @@ public class SearchActionMediumTest {
   @Test
   public void deprecated_paging() throws Exception {
     RuleDto rule = newRule();
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(defaultOrganization, "PROJECT_ID").setKey("PROJECT_KEY"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(defaultOrganization, "PROJECT_ID").setDbKey("PROJECT_KEY"));
     indexPermissions();
-    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setKey("FILE_KEY"));
+    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setDbKey("FILE_KEY"));
     for (int i = 0; i < 12; i++) {
       IssueDto issue = IssueTesting.newDto(rule, file, project);
       tester.get(IssueDao.class).insert(session, issue);
@@ -641,9 +641,9 @@ public class SearchActionMediumTest {
 
   @Test
   public void display_deprecated_debt_fields() throws Exception {
-    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization1, "PROJECT_ID").setKey("PROJECT_KEY"));
+    ComponentDto project = insertComponent(ComponentTesting.newPublicProjectDto(otherOrganization1, "PROJECT_ID").setDbKey("PROJECT_KEY"));
     indexPermissions();
-    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setKey("FILE_KEY"));
+    ComponentDto file = insertComponent(ComponentTesting.newFileDto(project, null, "FILE_ID").setDbKey("FILE_KEY"));
     IssueDto issue = IssueTesting.newDto(newRule(), file, project)
       .setIssueCreationDate(DateUtils.parseDate("2014-09-04"))
       .setIssueUpdateDate(DateUtils.parseDate("2017-12-04"))
index 7a5991c91b7a7f4aa09fd009b7896e4956fe2785..9ac22c0300f6a01cc9203ae796da46aefa5b492b 100644 (file)
@@ -96,7 +96,7 @@ public class CreateActionTest {
     dbSession.commit();
 
     OrganizationDto organizationDto = db.organizations().insert();
-    project = ComponentTesting.newPrivateProjectDto(organizationDto, DEFAULT_PROJECT_UUID).setKey(DEFAULT_PROJECT_KEY);
+    project = ComponentTesting.newPrivateProjectDto(organizationDto, DEFAULT_PROJECT_UUID).setDbKey(DEFAULT_PROJECT_KEY);
     dbClient.componentDao().insert(dbSession, project);
     dbSession.commit();
     userSession.logIn("login").addProjectPermission(UserRole.ADMIN, project);
@@ -452,7 +452,7 @@ public class CreateActionTest {
   public void fail_when_not_a_project() throws Exception {
     MetricDto metric = MetricTesting.newMetricDto().setEnabled(true).setValueType(STRING.name()).setKey("metric-key");
     dbClient.metricDao().insert(dbSession, metric);
-    dbClient.componentDao().insert(dbSession, ComponentTesting.newDirectory(project, "directory-uuid", "path/to/directory").setKey("directory-key"));
+    dbClient.componentDao().insert(dbSession, ComponentTesting.newDirectory(project, "directory-uuid", "path/to/directory").setDbKey("directory-key"));
     dbSession.commit();
 
     expectedException.expect(ServerException.class);
index 9a393e6a1cc5fc7ba376a98fc1302912938a3536..46898ada4765360cf29276398a75ba8d8de5c1d5 100644 (file)
@@ -229,7 +229,7 @@ public class MetricsActionTest {
 
   private ComponentDto insertProject(String projectUuid, String projectKey) {
     ComponentDto project = ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization(), projectUuid)
-      .setKey(projectKey);
+      .setDbKey(projectKey);
     dbClient.componentDao().insert(dbSession, project);
     dbSession.commit();
 
index e451752ceb628e10c798b3caa1b4eee9d1693192..ff61bf57a169c8de0afaa2bc484069d5366f33ce 100644 (file)
@@ -263,7 +263,7 @@ public class SearchActionTest {
 
   private ComponentDto insertProject(String projectUuid, String projectKey) {
     ComponentDto project = ComponentTesting.newPrivateProjectDto(db.organizations().insert(), projectUuid)
-      .setKey(projectKey);
+      .setDbKey(projectKey);
     dbClient.componentDao().insert(dbSession, project);
     dbSession.commit();
 
index d74c286d39465bdc81c8ab37919bc60ed9e97dd4..c08e5d13c484e3a17a2f9449d67c66f07ccb7b50 100644 (file)
@@ -144,7 +144,7 @@ public class UpdateActionTest {
       .setKey("metric-key");
     dbClient.metricDao().insert(dbSession, metric);
     OrganizationDto organizationDto = db.organizations().insert();
-    ComponentDto component = ComponentTesting.newPrivateProjectDto(organizationDto, "project-uuid").setKey("project-key");
+    ComponentDto component = ComponentTesting.newPrivateProjectDto(organizationDto, "project-uuid").setDbKey("project-key");
     dbClient.componentDao().insert(dbSession, component);
     CustomMeasureDto customMeasure = newCustomMeasure(component, metric)
       .setCreatedAt(100_000_000L)
index 734ce81bce908cead00c9a75e3d9790ca85427dd..f20a54a6b1e567071a1000dbdba1c2ad9749ea9b 100644 (file)
@@ -87,9 +87,9 @@ public class ProjectMeasuresIndexTest {
   private static final String LANGUAGES = "languages";
 
   private static final OrganizationDto ORG = OrganizationTesting.newOrganizationDto();
-  private static final ComponentDto PROJECT1 = ComponentTesting.newPrivateProjectDto(ORG).setUuid("Project-1").setName("Project 1").setKey("key-1");
-  private static final ComponentDto PROJECT2 = ComponentTesting.newPrivateProjectDto(ORG).setUuid("Project-2").setName("Project 2").setKey("key-2");
-  private static final ComponentDto PROJECT3 = ComponentTesting.newPrivateProjectDto(ORG).setUuid("Project-3").setName("Project 3").setKey("key-3");
+  private static final ComponentDto PROJECT1 = ComponentTesting.newPrivateProjectDto(ORG).setUuid("Project-1").setName("Project 1").setDbKey("key-1");
+  private static final ComponentDto PROJECT2 = ComponentTesting.newPrivateProjectDto(ORG).setUuid("Project-2").setName("Project 2").setDbKey("key-2");
+  private static final ComponentDto PROJECT3 = ComponentTesting.newPrivateProjectDto(ORG).setUuid("Project-3").setName("Project 3").setDbKey("key-3");
   private static final UserDto USER1 = newUserDto();
   private static final UserDto USER2 = newUserDto();
   private static final GroupDto GROUP1 = newGroupDto();
@@ -120,10 +120,10 @@ public class ProjectMeasuresIndexTest {
 
   @Test
   public void default_sort_is_by_ascending_case_insensitive_name_then_by_key() {
-    ComponentDto windows = ComponentTesting.newPrivateProjectDto(ORG).setUuid("windows").setName("Windows").setKey("project1");
-    ComponentDto apachee = ComponentTesting.newPrivateProjectDto(ORG).setUuid("apachee").setName("apachee").setKey("project2");
-    ComponentDto apache1 = ComponentTesting.newPrivateProjectDto(ORG).setUuid("apache-1").setName("Apache").setKey("project3");
-    ComponentDto apache2 = ComponentTesting.newPrivateProjectDto(ORG).setUuid("apache-2").setName("Apache").setKey("project4");
+    ComponentDto windows = ComponentTesting.newPrivateProjectDto(ORG).setUuid("windows").setName("Windows").setDbKey("project1");
+    ComponentDto apachee = ComponentTesting.newPrivateProjectDto(ORG).setUuid("apachee").setName("apachee").setDbKey("project2");
+    ComponentDto apache1 = ComponentTesting.newPrivateProjectDto(ORG).setUuid("apache-1").setName("Apache").setDbKey("project3");
+    ComponentDto apache2 = ComponentTesting.newPrivateProjectDto(ORG).setUuid("apache-2").setName("Apache").setDbKey("project4");
     index(newDoc(windows), newDoc(apachee), newDoc(apache1), newDoc(apache2));
 
     assertResults(new ProjectMeasuresQuery(), apache1, apache2, apachee, windows);
@@ -153,10 +153,10 @@ public class ProjectMeasuresIndexTest {
 
   @Test
   public void sort_by_a_metric_then_by_name_then_by_key() {
-    ComponentDto windows = ComponentTesting.newPrivateProjectDto(ORG).setUuid("windows").setName("Windows").setKey("project1");
-    ComponentDto apachee = ComponentTesting.newPrivateProjectDto(ORG).setUuid("apachee").setName("apachee").setKey("project2");
-    ComponentDto apache1 = ComponentTesting.newPrivateProjectDto(ORG).setUuid("apache-1").setName("Apache").setKey("project3");
-    ComponentDto apache2 = ComponentTesting.newPrivateProjectDto(ORG).setUuid("apache-2").setName("Apache").setKey("project4");
+    ComponentDto windows = ComponentTesting.newPrivateProjectDto(ORG).setUuid("windows").setName("Windows").setDbKey("project1");
+    ComponentDto apachee = ComponentTesting.newPrivateProjectDto(ORG).setUuid("apachee").setName("apachee").setDbKey("project2");
+    ComponentDto apache1 = ComponentTesting.newPrivateProjectDto(ORG).setUuid("apache-1").setName("Apache").setDbKey("project3");
+    ComponentDto apache2 = ComponentTesting.newPrivateProjectDto(ORG).setUuid("apache-2").setName("Apache").setDbKey("project4");
     index(
       newDoc(windows, NCLOC, 10_000d),
       newDoc(apachee, NCLOC, 5_000d),
@@ -169,7 +169,7 @@ public class ProjectMeasuresIndexTest {
 
   @Test
   public void sort_by_quality_gate_status() {
-    ComponentDto project4 = ComponentTesting.newPrivateProjectDto(ORG).setUuid("Project-4").setName("Project 4").setKey("key-4");
+    ComponentDto project4 = ComponentTesting.newPrivateProjectDto(ORG).setUuid("Project-4").setName("Project 4").setDbKey("key-4");
     index(
       newDoc(PROJECT1).setQualityGateStatus(OK.name()),
       newDoc(PROJECT2).setQualityGateStatus(ERROR.name()),
@@ -182,10 +182,10 @@ public class ProjectMeasuresIndexTest {
 
   @Test
   public void sort_by_quality_gate_status_then_by_name_then_by_key() {
-    ComponentDto windows = ComponentTesting.newPrivateProjectDto(ORG).setUuid("windows").setName("Windows").setKey("project1");
-    ComponentDto apachee = ComponentTesting.newPrivateProjectDto(ORG).setUuid("apachee").setName("apachee").setKey("project2");
-    ComponentDto apache1 = ComponentTesting.newPrivateProjectDto(ORG).setUuid("apache-1").setName("Apache").setKey("project3");
-    ComponentDto apache2 = ComponentTesting.newPrivateProjectDto(ORG).setUuid("apache-2").setName("Apache").setKey("project4");
+    ComponentDto windows = ComponentTesting.newPrivateProjectDto(ORG).setUuid("windows").setName("Windows").setDbKey("project1");
+    ComponentDto apachee = ComponentTesting.newPrivateProjectDto(ORG).setUuid("apachee").setName("apachee").setDbKey("project2");
+    ComponentDto apache1 = ComponentTesting.newPrivateProjectDto(ORG).setUuid("apache-1").setName("Apache").setDbKey("project3");
+    ComponentDto apache2 = ComponentTesting.newPrivateProjectDto(ORG).setUuid("apache-2").setName("Apache").setDbKey("project4");
     index(
       newDoc(windows).setQualityGateStatus(WARN.name()),
       newDoc(apachee).setQualityGateStatus(OK.name()),
@@ -343,7 +343,7 @@ public class ProjectMeasuresIndexTest {
 
   @Test
   public void filter_on_languages() {
-    ComponentDto project4 = ComponentTesting.newPrivateProjectDto(ORG).setUuid("Project-4").setName("Project 4").setKey("key-4");
+    ComponentDto project4 = ComponentTesting.newPrivateProjectDto(ORG).setUuid("Project-4").setName("Project 4").setDbKey("key-4");
     index(
       newDoc(PROJECT1).setLanguages(singletonList("java")),
       newDoc(PROJECT2).setLanguages(singletonList("xoo")),
@@ -357,10 +357,10 @@ public class ProjectMeasuresIndexTest {
 
   @Test
   public void filter_on_query_text() {
-    ComponentDto windows = ComponentTesting.newPrivateProjectDto(ORG).setUuid("windows").setName("Windows").setKey("project1");
-    ComponentDto apachee = ComponentTesting.newPrivateProjectDto(ORG).setUuid("apachee").setName("apachee").setKey("project2");
-    ComponentDto apache1 = ComponentTesting.newPrivateProjectDto(ORG).setUuid("apache-1").setName("Apache").setKey("project3");
-    ComponentDto apache2 = ComponentTesting.newPrivateProjectDto(ORG).setUuid("apache-2").setName("Apache").setKey("project4");
+    ComponentDto windows = ComponentTesting.newPrivateProjectDto(ORG).setUuid("windows").setName("Windows").setDbKey("project1");
+    ComponentDto apachee = ComponentTesting.newPrivateProjectDto(ORG).setUuid("apachee").setName("apachee").setDbKey("project2");
+    ComponentDto apache1 = ComponentTesting.newPrivateProjectDto(ORG).setUuid("apache-1").setName("Apache").setDbKey("project3");
+    ComponentDto apache2 = ComponentTesting.newPrivateProjectDto(ORG).setUuid("apache-2").setName("Apache").setDbKey("project4");
     index(newDoc(windows), newDoc(apachee), newDoc(apache1), newDoc(apache2));
 
     assertResults(new ProjectMeasuresQuery().setQueryText("windows"), windows);
@@ -1409,7 +1409,7 @@ public class ProjectMeasuresIndexTest {
     return new ProjectMeasuresDoc()
       .setOrganizationUuid(project.getOrganizationUuid())
       .setId(project.uuid())
-      .setKey(project.key())
+      .setKey(project.getDbKey())
       .setName(project.name());
   }
 
index bdfe00318a1dcf1aba21ad631ec2dfdada56abf8..6673302c3dfad9a6d4d481162ec41e4690b95458 100644 (file)
@@ -192,8 +192,8 @@ public class ProjectMeasuresIndexTextSearchTest {
   @Test
   public void match_exact_case_insensitive_key() {
     index(
-      newDoc(newPrivateProjectDto(ORG).setUuid("project1").setName("Windows").setKey("project1")),
-      newDoc(newPrivateProjectDto(ORG).setUuid("project2").setName("apachee").setKey("project2")));
+      newDoc(newPrivateProjectDto(ORG).setUuid("project1").setName("Windows").setDbKey("project1")),
+      newDoc(newPrivateProjectDto(ORG).setUuid("project2").setName("apachee").setDbKey("project2")));
 
     assertTextQueryResults("project1", "project1");
     assertTextQueryResults("PROJECT1", "project1");
@@ -203,8 +203,8 @@ public class ProjectMeasuresIndexTextSearchTest {
   @Test
   public void match_key_with_dot() {
     index(
-      newDoc(newPrivateProjectDto(ORG).setUuid("sonarqube").setName("SonarQube").setKey("org.sonarqube")),
-      newDoc(newPrivateProjectDto(ORG).setUuid("sq").setName("SQ").setKey("sonarqube")));
+      newDoc(newPrivateProjectDto(ORG).setUuid("sonarqube").setName("SonarQube").setDbKey("org.sonarqube")),
+      newDoc(newPrivateProjectDto(ORG).setUuid("sq").setName("SQ").setDbKey("sonarqube")));
 
     assertTextQueryResults("org.sonarqube", "sonarqube");
     assertNoResults("orgsonarqube");
@@ -216,8 +216,8 @@ public class ProjectMeasuresIndexTextSearchTest {
   @Test
   public void match_key_with_dash() {
     index(
-      newDoc(newPrivateProjectDto(ORG).setUuid("sonarqube").setName("SonarQube").setKey("org-sonarqube")),
-      newDoc(newPrivateProjectDto(ORG).setUuid("sq").setName("SQ").setKey("sonarqube")));
+      newDoc(newPrivateProjectDto(ORG).setUuid("sonarqube").setName("SonarQube").setDbKey("org-sonarqube")),
+      newDoc(newPrivateProjectDto(ORG).setUuid("sq").setName("SQ").setDbKey("sonarqube")));
 
     assertTextQueryResults("org-sonarqube", "sonarqube");
     assertNoResults("orgsonarqube");
@@ -229,8 +229,8 @@ public class ProjectMeasuresIndexTextSearchTest {
   @Test
   public void match_key_with_colon() {
     index(
-      newDoc(newPrivateProjectDto(ORG).setUuid("sonarqube").setName("SonarQube").setKey("org:sonarqube")),
-      newDoc(newPrivateProjectDto(ORG).setUuid("sq").setName("SQ").setKey("sonarqube")));
+      newDoc(newPrivateProjectDto(ORG).setUuid("sonarqube").setName("SonarQube").setDbKey("org:sonarqube")),
+      newDoc(newPrivateProjectDto(ORG).setUuid("sq").setName("SQ").setDbKey("sonarqube")));
 
     assertTextQueryResults("org:sonarqube", "sonarqube");
     assertNoResults("orgsonarqube");
@@ -241,14 +241,14 @@ public class ProjectMeasuresIndexTextSearchTest {
 
   @Test
   public void match_key_having_all_special_characters() {
-    index(newDoc(newPrivateProjectDto(ORG).setUuid("sonarqube").setName("SonarQube").setKey("org.sonarqube:sonar-sérvèr_ç")));
+    index(newDoc(newPrivateProjectDto(ORG).setUuid("sonarqube").setName("SonarQube").setDbKey("org.sonarqube:sonar-sérvèr_ç")));
 
     assertTextQueryResults("org.sonarqube:sonar-sérvèr_ç", "sonarqube");
   }
 
   @Test
   public void does_not_match_partial_key() {
-    index(newDoc(newPrivateProjectDto(ORG).setUuid("project").setName("some name").setKey("theKey")));
+    index(newDoc(newPrivateProjectDto(ORG).setUuid("project").setName("some name").setDbKey("theKey")));
 
     assertNoResults("theke");
     assertNoResults("hekey");
@@ -258,12 +258,12 @@ public class ProjectMeasuresIndexTextSearchTest {
   public void facets_take_into_account_text_search() {
     index(
       // docs with ncloc<1K
-      newDoc(newPrivateProjectDto(ORG).setName("Windows").setKey("project1"), NCLOC, 0d),
-      newDoc(newPrivateProjectDto(ORG).setName("apachee").setKey("project2"), NCLOC, 999d),
+      newDoc(newPrivateProjectDto(ORG).setName("Windows").setDbKey("project1"), NCLOC, 0d),
+      newDoc(newPrivateProjectDto(ORG).setName("apachee").setDbKey("project2"), NCLOC, 999d),
       // docs with ncloc>=1K and ncloc<10K
-      newDoc(newPrivateProjectDto(ORG).setName("Apache").setKey("project3"), NCLOC, 1_000d),
+      newDoc(newPrivateProjectDto(ORG).setName("Apache").setDbKey("project3"), NCLOC, 1_000d),
       // docs with ncloc>=100K and ncloc<500K
-      newDoc(newPrivateProjectDto(ORG).setName("Apache Foundation").setKey("project4"), NCLOC, 100_000d));
+      newDoc(newPrivateProjectDto(ORG).setName("Apache Foundation").setDbKey("project4"), NCLOC, 100_000d));
 
     assertNclocFacet(new ProjectMeasuresQuery().setQueryText("apache"), 1L, 1L, 0L, 1L, 0L);
     assertNclocFacet(new ProjectMeasuresQuery().setQueryText("PAch"), 1L, 1L, 0L, 1L, 0L);
@@ -275,10 +275,10 @@ public class ProjectMeasuresIndexTextSearchTest {
   @Test
   public void filter_by_metric_take_into_account_text_search() {
     index(
-      newDoc(newPrivateProjectDto(ORG).setUuid("project1").setName("Windows").setKey("project1"), NCLOC, 30_000d),
-      newDoc(newPrivateProjectDto(ORG).setUuid("project2").setName("apachee").setKey("project2"), NCLOC, 40_000d),
-      newDoc(newPrivateProjectDto(ORG).setUuid("project3").setName("Apache").setKey("project3"), NCLOC, 50_000d),
-      newDoc(newPrivateProjectDto(ORG).setUuid("project4").setName("Apache").setKey("project4"), NCLOC, 60_000d));
+      newDoc(newPrivateProjectDto(ORG).setUuid("project1").setName("Windows").setDbKey("project1"), NCLOC, 30_000d),
+      newDoc(newPrivateProjectDto(ORG).setUuid("project2").setName("apachee").setDbKey("project2"), NCLOC, 40_000d),
+      newDoc(newPrivateProjectDto(ORG).setUuid("project3").setName("Apache").setDbKey("project3"), NCLOC, 50_000d),
+      newDoc(newPrivateProjectDto(ORG).setUuid("project4").setName("Apache").setDbKey("project4"), NCLOC, 60_000d));
 
     assertResults(new ProjectMeasuresQuery().setQueryText("apache").addMetricCriterion(MetricCriterion.create(NCLOC, GT, 20_000d)), "project3", "project4", "project2");
     assertResults(new ProjectMeasuresQuery().setQueryText("apache").addMetricCriterion(MetricCriterion.create(NCLOC, LT, 55_000d)), "project3", "project2");
@@ -300,7 +300,7 @@ public class ProjectMeasuresIndexTextSearchTest {
     return new ProjectMeasuresDoc()
       .setOrganizationUuid(project.getOrganizationUuid())
       .setId(project.uuid())
-      .setKey(project.key())
+      .setKey(project.getDbKey())
       .setName(project.name());
   }
 
index b97c6656d0cff6be33958582d7d99e765cdb78de..5cfa199ddc24849ebe1c375d4a12e06c57a47a38 100644 (file)
@@ -134,7 +134,7 @@ public class ComponentActionTest {
 
   @Test
   public void reference_uuid_in_the_response() {
-    ComponentDto project = newPrivateProjectDto(db.getDefaultOrganization(), "project-uuid").setKey("project-key");
+    ComponentDto project = newPrivateProjectDto(db.getDefaultOrganization(), "project-uuid").setDbKey("project-key");
     componentDb.insertProjectAndSnapshot(project);
     ComponentDto view = newView(db.getDefaultOrganization(), "view-uuid");
     componentDb.insertViewAndSnapshot(view);
@@ -211,7 +211,7 @@ public class ComponentActionTest {
   @Test
   public void fail_when_component_is_removed() {
     ComponentDto project = componentDb.insertComponent(newPrivateProjectDto(db.getDefaultOrganization()));
-    componentDb.insertComponent(newFileDto(project).setKey("file-key").setEnabled(false));
+    componentDb.insertComponent(newFileDto(project).setDbKey("file-key").setEnabled(false));
     userSession.addProjectPermission(USER, project);
     insertNclocMetric();
 
@@ -292,7 +292,7 @@ public class ComponentActionTest {
       .setPeriodParam("1.0-SNAPSHOT");
     ComponentDto file = newFileDto(project, null)
       .setUuid("AVIwDXE-bJbJqrw6wFv5")
-      .setKey("MY_PROJECT:ElementImpl.java")
+      .setDbKey("MY_PROJECT:ElementImpl.java")
       .setName("ElementImpl.java")
       .setQualifier(Qualifiers.FILE)
       .setLanguage("java")
index babbb8c0221cb1216e84de21f479a654eca92d05..6f14704292a11e3ed5ded011003d9ee60e5b368f 100644 (file)
@@ -622,7 +622,7 @@ public class ComponentTreeActionTest {
   @Test
   public void fail_when_component_is_removed() {
     ComponentDto project = componentDb.insertComponent(newPrivateProjectDto(db.getDefaultOrganization()));
-    componentDb.insertComponent(newFileDto(project).setKey("file-key").setEnabled(false));
+    componentDb.insertComponent(newFileDto(project).setDbKey("file-key").setEnabled(false));
     userSession.anonymous().addProjectPermission(UserRole.USER, project);
     insertNclocMetric();
 
@@ -645,7 +645,7 @@ public class ComponentTreeActionTest {
 
   private void insertJsonExampleData() {
     ComponentDto project = newPrivateProjectDto(db.getDefaultOrganization(), "project-id")
-      .setKey("MY_PROJECT")
+      .setDbKey("MY_PROJECT")
       .setName("My Project")
       .setQualifier(Qualifiers.PROJECT);
     componentDb.insertComponent(project);
@@ -656,21 +656,21 @@ public class ComponentTreeActionTest {
 
     ComponentDto file1 = componentDb.insertComponent(newFileDto(project, null)
       .setUuid("AVIwDXE-bJbJqrw6wFv5")
-      .setKey("com.sonarsource:java-markdown:src/main/java/com/sonarsource/markdown/impl/ElementImpl.java")
+      .setDbKey("com.sonarsource:java-markdown:src/main/java/com/sonarsource/markdown/impl/ElementImpl.java")
       .setName("ElementImpl.java")
       .setLanguage("java")
       .setQualifier(Qualifiers.FILE)
       .setPath("src/main/java/com/sonarsource/markdown/impl/ElementImpl.java"));
     ComponentDto file2 = componentDb.insertComponent(newFileDto(project, null)
       .setUuid("AVIwDXE_bJbJqrw6wFwJ")
-      .setKey("com.sonarsource:java-markdown:src/test/java/com/sonarsource/markdown/impl/ElementImplTest.java")
+      .setDbKey("com.sonarsource:java-markdown:src/test/java/com/sonarsource/markdown/impl/ElementImplTest.java")
       .setName("ElementImplTest.java")
       .setLanguage("java")
       .setQualifier(Qualifiers.UNIT_TEST_FILE)
       .setPath("src/test/java/com/sonarsource/markdown/impl/ElementImplTest.java"));
     ComponentDto dir = componentDb.insertComponent(newDirectory(project, "src/main/java/com/sonarsource/markdown/impl")
       .setUuid("AVIwDXE-bJbJqrw6wFv8")
-      .setKey("com.sonarsource:java-markdown:src/main/java/com/sonarsource/markdown/impl")
+      .setDbKey("com.sonarsource:java-markdown:src/main/java/com/sonarsource/markdown/impl")
       .setQualifier(Qualifiers.DIRECTORY));
 
     MetricDto complexity = insertComplexityMetric();
index 3e5302a2fdd27e929edbaf672a1022d0961a7925..83ba85dcf35bd012c1c8e61ea4a2dec14e518854 100644 (file)
@@ -115,7 +115,7 @@ public class SearchActionTest {
     dbClient.measureDao().insert(dbSession, newMeasureDto(coverage, project, projectSnapshot).setValue(15.5d));
     db.commit();
 
-    SearchWsResponse result = call(singletonList(project.key()), singletonList("coverage"));
+    SearchWsResponse result = call(singletonList(project.getDbKey()), singletonList("coverage"));
 
     List<Measure> measures = result.getMeasuresList();
     assertThat(measures).hasSize(1);
@@ -136,7 +136,7 @@ public class SearchActionTest {
         .setVariation(10d));
     db.commit();
 
-    SearchWsResponse result = call(singletonList(project.key()), singletonList("coverage"));
+    SearchWsResponse result = call(singletonList(project.getDbKey()), singletonList("coverage"));
 
     List<Measure> measures = result.getMeasuresList();
     assertThat(measures).hasSize(1);
@@ -168,12 +168,12 @@ public class SearchActionTest {
     dbClient.measureDao().insert(dbSession, newMeasureDto(complexity, project3, projectSnapshot3).setValue(20d));
     db.commit();
 
-    SearchWsResponse result = call(asList(project1.key(), project2.key(), project3.key()), asList("coverage", "complexity"));
+    SearchWsResponse result = call(asList(project1.getDbKey(), project2.getDbKey(), project3.getDbKey()), asList("coverage", "complexity"));
 
     assertThat(result.getMeasuresList()).extracting(Measure::getMetric, Measure::getComponent)
       .containsExactly(
-        tuple("complexity", project2.key()), tuple("complexity", project3.key()), tuple("complexity", project1.key()),
-        tuple("coverage", project2.key()), tuple("coverage", project3.key()), tuple("coverage", project1.key()));
+        tuple("complexity", project2.getDbKey()), tuple("complexity", project3.getDbKey()), tuple("complexity", project1.getDbKey()),
+        tuple("coverage", project2.getDbKey()), tuple("coverage", project3.getDbKey()), tuple("coverage", project1.getDbKey()));
   }
 
   @Test
@@ -184,7 +184,7 @@ public class SearchActionTest {
     dbClient.measureDao().insert(dbSession, newMeasureDto(coverage, view, viewSnapshot).setValue(15.5d));
     db.commit();
 
-    SearchWsResponse result = call(singletonList(view.key()), singletonList("coverage"));
+    SearchWsResponse result = call(singletonList(view.getDbKey()), singletonList("coverage"));
 
     List<Measure> measures = result.getMeasuresList();
     assertThat(measures).hasSize(1);
@@ -202,7 +202,7 @@ public class SearchActionTest {
     dbClient.measureDao().insert(dbSession, newMeasureDto(coverage, application, viewSnapshot).setValue(15.5d));
     db.commit();
 
-    SearchWsResponse result = call(singletonList(application.key()), singletonList("coverage"));
+    SearchWsResponse result = call(singletonList(application.getDbKey()), singletonList("coverage"));
 
     List<Measure> measures = result.getMeasuresList();
     assertThat(measures).hasSize(1);
@@ -220,7 +220,7 @@ public class SearchActionTest {
     dbClient.measureDao().insert(dbSession, newMeasureDto(coverage, subView, viewSnapshot).setValue(15.5d));
     db.commit();
 
-    SearchWsResponse result = call(singletonList(subView.key()), singletonList("coverage"));
+    SearchWsResponse result = call(singletonList(subView.getDbKey()), singletonList("coverage"));
 
     List<Measure> measures = result.getMeasuresList();
     assertThat(measures).hasSize(1);
@@ -242,9 +242,9 @@ public class SearchActionTest {
     db.commit();
     setBrowsePermissionOnUser(project1);
 
-    SearchWsResponse result = call(asList(project1.key(), project2.key()), singletonList("complexity"));
+    SearchWsResponse result = call(asList(project1.getDbKey(), project2.getDbKey()), singletonList("complexity"));
 
-    assertThat(result.getMeasuresList()).extracting(Measure::getComponent).containsOnly(project1.key());
+    assertThat(result.getMeasuresList()).extracting(Measure::getComponent).containsOnly(project1.getDbKey());
   }
 
   @Test
@@ -256,11 +256,11 @@ public class SearchActionTest {
     db.commit();
 
     userSession.setNonRoot();
-    SearchWsResponse result = call(asList(project1.key()), singletonList("complexity"));
+    SearchWsResponse result = call(asList(project1.getDbKey()), singletonList("complexity"));
     assertThat(result.getMeasuresCount()).isEqualTo(0);
 
     userSession.setRoot();
-    result = call(asList(project1.key()), singletonList("complexity"));
+    result = call(asList(project1.getDbKey()), singletonList("complexity"));
     assertThat(result.getMeasuresCount()).isEqualTo(1);
   }
 
@@ -295,7 +295,7 @@ public class SearchActionTest {
     expectedException.expect(BadRequestException.class);
     expectedException.expectMessage("The following metrics are not found: ncloc, violations");
 
-    call(singletonList(project.key()), newArrayList("violations", "complexity", "ncloc"));
+    call(singletonList(project.getDbKey()), newArrayList("violations", "complexity", "ncloc"));
   }
 
   @Test
@@ -322,7 +322,7 @@ public class SearchActionTest {
   public void fail_if_more_than_100_project_keys() {
     List<String> keys = IntStream.rangeClosed(1, 101)
       .mapToObj(i -> db.components().insertPrivateProject())
-      .map(ComponentDto::key)
+      .map(ComponentDto::getDbKey)
       .collect(Collectors.toList());
     insertComplexityMetric();
 
@@ -336,7 +336,7 @@ public class SearchActionTest {
   public void does_not_fail_on_100_projects() {
     List<String> keys = IntStream.rangeClosed(1, 100)
       .mapToObj(i -> db.components().insertPrivateProject())
-      .map(ComponentDto::key)
+      .map(ComponentDto::getDbKey)
       .collect(Collectors.toList());
     insertComplexityMetric();
 
@@ -353,7 +353,7 @@ public class SearchActionTest {
     expectedException.expect(IllegalArgumentException.class);
     expectedException.expectMessage("Only component of qualifiers [TRK, APP, VW, SVW] are allowed");
 
-    call(singletonList(module.key()), singletonList("complexity"));
+    call(singletonList(module.getDbKey()), singletonList("complexity"));
   }
 
   @Test
@@ -366,7 +366,7 @@ public class SearchActionTest {
     expectedException.expect(IllegalArgumentException.class);
     expectedException.expectMessage("Only component of qualifiers [TRK, APP, VW, SVW] are allowed");
 
-    call(singletonList(dir.key()), singletonList("complexity"));
+    call(singletonList(dir.getDbKey()), singletonList("complexity"));
   }
 
   @Test
@@ -379,7 +379,7 @@ public class SearchActionTest {
     expectedException.expect(IllegalArgumentException.class);
     expectedException.expectMessage("Only component of qualifiers [TRK, APP, VW, SVW] are allowed");
 
-    call(singletonList(file.key()), singletonList("complexity"));
+    call(singletonList(file.getDbKey()), singletonList("complexity"));
   }
 
   @Test
@@ -478,10 +478,10 @@ public class SearchActionTest {
   private List<String> insertJsonExampleData() {
     List<String> projectKeys = new ArrayList<>();
     OrganizationDto organizationDto = db.organizations().insert();
-    ComponentDto project1 = ComponentTesting.newPrivateProjectDto(organizationDto).setKey("MY_PROJECT_1").setName("Project 1");
-    ComponentDto project2 = ComponentTesting.newPrivateProjectDto(organizationDto).setKey("MY_PROJECT_2").setName("Project 2");
-    ComponentDto project3 = ComponentTesting.newPrivateProjectDto(organizationDto).setKey("MY_PROJECT_3").setName("Project 3");
-    projectKeys.addAll(asList(project1.key(), project2.key(), project3.key()));
+    ComponentDto project1 = ComponentTesting.newPrivateProjectDto(organizationDto).setDbKey("MY_PROJECT_1").setName("Project 1");
+    ComponentDto project2 = ComponentTesting.newPrivateProjectDto(organizationDto).setDbKey("MY_PROJECT_2").setName("Project 2");
+    ComponentDto project3 = ComponentTesting.newPrivateProjectDto(organizationDto).setDbKey("MY_PROJECT_3").setName("Project 3");
+    projectKeys.addAll(asList(project1.getDbKey(), project2.getDbKey(), project3.getDbKey()));
     db.components().insertComponents(project1, project2, project3);
     SnapshotDto projectSnapshot1 = dbClient.snapshotDao().insert(dbSession, newAnalysis(project1)
       .setPeriodDate(parseDateTime("2016-01-11T10:49:50+0100").getTime())
index 0f3917642f51572c4b9be3f5198a663871bba2c5..25a0782cf2c97c9044670a3960fa28aaadd2b47d 100644 (file)
@@ -100,7 +100,7 @@ public class SearchHistoryActionTest {
     complexityMetric = insertComplexityMetric();
     newViolationMetric = insertNewViolationMetric();
     metrics = newArrayList(nclocMetric.getKey(), complexityMetric.getKey(), newViolationMetric.getKey());
-    wsRequest = SearchHistoryRequest.builder().setComponent(project.getKey()).setMetrics(metrics);
+    wsRequest = SearchHistoryRequest.builder().setComponent(project.getDbKey()).setMetrics(metrics);
   }
 
   @Test
@@ -108,7 +108,7 @@ public class SearchHistoryActionTest {
     project = db.components().insertPrivateProject();
     userSession.addProjectPermission(UserRole.USER, project);
     wsRequest
-      .setComponent(project.getKey())
+      .setComponent(project.getDbKey())
       .setMetrics(singletonList(complexityMetric.getKey()));
 
     SearchHistoryResponse result = call();
@@ -127,7 +127,7 @@ public class SearchHistoryActionTest {
     analysis = db.components().insertSnapshot(project);
     userSession.addProjectPermission(UserRole.USER, project);
     wsRequest
-      .setComponent(project.getKey())
+      .setComponent(project.getDbKey())
       .setMetrics(singletonList(complexityMetric.getKey()));
 
     SearchHistoryResponse result = call();
@@ -197,7 +197,7 @@ public class SearchHistoryActionTest {
       .map(a -> formatDateTime(a.getCreatedAt()))
       .collect(MoreCollectors.toList());
     db.commit();
-    wsRequest.setComponent(project.getKey()).setPage(2).setPageSize(3);
+    wsRequest.setComponent(project.getDbKey()).setPage(2).setPageSize(3);
 
     SearchHistoryResponse result = call();
 
@@ -216,7 +216,7 @@ public class SearchHistoryActionTest {
       .map(a -> formatDateTime(a.getCreatedAt()))
       .collect(MoreCollectors.toList());
     db.commit();
-    wsRequest.setComponent(project.getKey()).setFrom(analysisDates.get(1)).setTo(analysisDates.get(3));
+    wsRequest.setComponent(project.getDbKey()).setFrom(analysisDates.get(1)).setTo(analysisDates.get(3));
 
     SearchHistoryResponse result = call();
 
@@ -231,7 +231,7 @@ public class SearchHistoryActionTest {
     dbClient.metricDao().insert(dbSession, newMetricDto().setKey("new_optimized").setValueType(ValueType.INT.name()).setOptimizedBestValue(true).setBestValue(789d));
     db.commit();
     ComponentDto file = db.components().insertComponent(newFileDto(project));
-    wsRequest.setComponent(file.getKey()).setMetrics(Arrays.asList("optimized", "new_optimized"));
+    wsRequest.setComponent(file.getDbKey()).setMetrics(Arrays.asList("optimized", "new_optimized"));
 
     SearchHistoryResponse result = call();
 
@@ -240,7 +240,7 @@ public class SearchHistoryActionTest {
     assertThat(result.getMeasuresList().get(1).getHistoryList()).extracting(HistoryValue::getValue).containsExactly("456");
 
     // Best value is not applied to project
-    wsRequest.setComponent(project.getKey());
+    wsRequest.setComponent(project.getDbKey());
     result = call();
     assertThat(result.getMeasuresList().get(0).getHistoryCount()).isEqualTo(1);
     assertThat(result.getMeasuresList().get(0).getHistory(0).hasDate()).isTrue();
@@ -303,7 +303,7 @@ public class SearchHistoryActionTest {
   @Test
   public void fail_when_component_is_removed() {
     ComponentDto project = db.components().insertComponent(newPrivateProjectDto(db.getDefaultOrganization()));
-    db.components().insertComponent(newFileDto(project).setKey("file-key").setEnabled(false));
+    db.components().insertComponent(newFileDto(project).setDbKey("file-key").setEnabled(false));
     userSession.addProjectPermission(UserRole.USER, project);
 
     expectedException.expect(NotFoundException.class);
@@ -340,7 +340,7 @@ public class SearchHistoryActionTest {
     db.commit();
 
     String result = ws.newRequest()
-      .setParam(PARAM_COMPONENT, project.getKey())
+      .setParam(PARAM_COMPONENT, project.getDbKey())
       .setParam(PARAM_METRICS, String.join(",", metrics))
       .execute().getInput();
 
index 327e90db3b68a4dbaea55354e5fe512f407d5897..8c573bf92852210e646f76fefc62b2b9c3d4b952 100644 (file)
@@ -122,7 +122,7 @@ public class AddActionTest {
   public void add_a_project_notification() {
     ComponentDto project = db.components().insertPrivateProject();
 
-    call(request.setProject(project.getKey()));
+    call(request.setProject(project.getDbKey()));
 
     db.notifications().assertExists(defaultChannel.getKey(), NOTIF_MY_NEW_ISSUES, userSession.getUserId(), project);
   }
@@ -130,7 +130,7 @@ public class AddActionTest {
   @Test
   public void add_a_global_notification_when_a_project_one_exists() {
     ComponentDto project = db.components().insertPrivateProject();
-    call(request.setProject(project.getKey()));
+    call(request.setProject(project.getDbKey()));
 
     call(request.setProject(null));
 
@@ -143,7 +143,7 @@ public class AddActionTest {
     ComponentDto project = db.components().insertPrivateProject();
     call(request);
 
-    call(request.setProject(project.getKey()));
+    call(request.setProject(project.getDbKey()));
 
     db.notifications().assertExists(defaultChannel.getKey(), NOTIF_MY_NEW_ISSUES, userSession.getUserId(), project);
     db.notifications().assertExists(defaultChannel.getKey(), NOTIF_MY_NEW_ISSUES, userSession.getUserId(), null);
@@ -216,7 +216,7 @@ public class AddActionTest {
     expectedException.expect(BadRequestException.class);
     expectedException.expectMessage("Value of parameter 'type' (Dispatcher42) must be one of: [Dispatcher1, Dispatcher3]");
 
-    call(request.setType("Dispatcher42").setProject(project.key()));
+    call(request.setType("Dispatcher42").setProject(project.getDbKey()));
   }
 
   @Test
@@ -235,7 +235,7 @@ public class AddActionTest {
 
   @Test
   public void fail_when_component_is_not_a_project() {
-    db.components().insertViewAndSnapshot(newView(db.organizations().insert()).setKey("VIEW_1"));
+    db.components().insertViewAndSnapshot(newView(db.organizations().insert()).setDbKey("VIEW_1"));
 
     expectedException.expect(BadRequestException.class);
     expectedException.expectMessage("Component 'VIEW_1' must be a project");
index 7707606d715bd233cf9ffcad19d2cb3441dcb2cd..554b36f2dd294b7bffc0658789becb5c8915a730 100644 (file)
@@ -120,7 +120,7 @@ public class ListActionTest {
 
   @Test
   public void filter_unauthorized_projects() {
-    ComponentDto project = addComponent(ComponentTesting.newPrivateProjectDto(db.organizations().insert()).setKey("K1"));
+    ComponentDto project = addComponent(ComponentTesting.newPrivateProjectDto(db.organizations().insert()).setDbKey("K1"));
     ComponentDto anotherProject = db.components().insertPrivateProject();
     notificationUpdater.add(dbSession, emailChannel.getKey(), NOTIF_MY_NEW_ISSUES, user, project);
     notificationUpdater.add(dbSession, emailChannel.getKey(), NOTIF_MY_NEW_ISSUES, user, anotherProject);
@@ -155,7 +155,7 @@ public class ListActionTest {
 
   @Test
   public void filter_per_project_dispatchers() {
-    ComponentDto project = addComponent(ComponentTesting.newPrivateProjectDto(db.organizations().insert()).setKey("K1"));
+    ComponentDto project = addComponent(ComponentTesting.newPrivateProjectDto(db.organizations().insert()).setDbKey("K1"));
     notificationUpdater.add(dbSession, emailChannel.getKey(), NOTIF_MY_NEW_ISSUES, user, project);
     notificationUpdater.add(dbSession, emailChannel.getKey(), "Unknown Notification", user, project);
     dbSession.commit();
@@ -170,7 +170,7 @@ public class ListActionTest {
   @Test
   public void order_with_global_then_by_channel_and_dispatcher() {
     OrganizationDto organization = db.organizations().insert();
-    ComponentDto project = addComponent(ComponentTesting.newPrivateProjectDto(organization).setKey("K1"));
+    ComponentDto project = addComponent(ComponentTesting.newPrivateProjectDto(organization).setDbKey("K1"));
     notificationUpdater.add(dbSession, twitterChannel.getKey(), NOTIF_MY_NEW_ISSUES, user, null);
     notificationUpdater.add(dbSession, emailChannel.getKey(), NOTIF_MY_NEW_ISSUES, user, null);
     notificationUpdater.add(dbSession, emailChannel.getKey(), NOTIF_NEW_ISSUES, user, null);
@@ -231,7 +231,7 @@ public class ListActionTest {
   @Test
   public void json_example() {
     OrganizationDto organization = db.organizations().insertForKey("my-org-1");
-    ComponentDto project = addComponent(ComponentTesting.newPrivateProjectDto(organization).setKey(KEY_PROJECT_EXAMPLE_001).setName("My Project"));
+    ComponentDto project = addComponent(ComponentTesting.newPrivateProjectDto(organization).setDbKey(KEY_PROJECT_EXAMPLE_001).setName("My Project"));
     notificationUpdater.add(dbSession, twitterChannel.getKey(), NOTIF_MY_NEW_ISSUES, user, null);
     notificationUpdater.add(dbSession, emailChannel.getKey(), NOTIF_MY_NEW_ISSUES, user, null);
     notificationUpdater.add(dbSession, emailChannel.getKey(), NOTIF_NEW_ISSUES, user, null);
index d4d16117e2cd86fdf4cf1f546e096230918954d3..1a33c4adc6d6d4c101af0a6187adb77db98e889f 100644 (file)
@@ -130,7 +130,7 @@ public class RemoveActionTest {
     notificationUpdater.add(dbSession, defaultChannel.getKey(), NOTIF_MY_NEW_ISSUES, user, project);
     dbSession.commit();
 
-    call(request.setProject(project.getKey()));
+    call(request.setProject(project.getDbKey()));
 
     db.notifications().assertDoesNotExist(defaultChannel.getKey(), NOTIF_MY_NEW_ISSUES, user.getId(), project);
   }
@@ -156,7 +156,7 @@ public class RemoveActionTest {
     expectedException.expect(IllegalArgumentException.class);
     expectedException.expectMessage("Notification doesn't exist");
 
-    call(request.setProject(project.getKey()));
+    call(request.setProject(project.getDbKey()));
   }
 
   @Test
@@ -232,7 +232,7 @@ public class RemoveActionTest {
     expectedException.expect(BadRequestException.class);
     expectedException.expectMessage("Value of parameter 'type' (Dispatcher42) must be one of: [Dispatcher1, Dispatcher3]");
 
-    call(request.setType("Dispatcher42").setProject(project.key()));
+    call(request.setType("Dispatcher42").setProject(project.getDbKey()));
   }
 
   @Test
@@ -251,7 +251,7 @@ public class RemoveActionTest {
 
   @Test
   public void fail_when_component_is_not_a_project() {
-    db.components().insertViewAndSnapshot(newView(db.organizations().insert()).setKey("VIEW_1"));
+    db.components().insertViewAndSnapshot(newView(db.organizations().insert()).setDbKey("VIEW_1"));
 
     expectedException.expect(BadRequestException.class);
     expectedException.expectMessage("Component 'VIEW_1' must be a project");
index d99a6d98482cd59a16b8f0bb5d0acb858da5faf5..bfdfaf80b722aecc19a60bcf2d56ea3298df0e04 100644 (file)
@@ -106,7 +106,7 @@ public class AddGroupActionTest extends BasePermissionWsTest<AddGroupAction> {
   @Test
   public void add_permission_to_project_referenced_by_its_id() throws Exception {
     GroupDto group = db.users().insertGroup(db.getDefaultOrganization(), "sonar-administrators");
-    ComponentDto project = db.components().insertComponent(newPrivateProjectDto(db.getDefaultOrganization(), A_PROJECT_UUID).setKey(A_PROJECT_KEY));
+    ComponentDto project = db.components().insertComponent(newPrivateProjectDto(db.getDefaultOrganization(), A_PROJECT_UUID).setDbKey(A_PROJECT_KEY));
     loginAsAdmin(db.getDefaultOrganization());
 
     newRequest()
@@ -122,7 +122,7 @@ public class AddGroupActionTest extends BasePermissionWsTest<AddGroupAction> {
   @Test
   public void add_permission_to_project_referenced_by_its_key() throws Exception {
     GroupDto group = db.users().insertGroup(db.getDefaultOrganization(), "sonar-administrators");
-    ComponentDto project = db.components().insertComponent(newPrivateProjectDto(db.getDefaultOrganization(), A_PROJECT_UUID).setKey(A_PROJECT_KEY));
+    ComponentDto project = db.components().insertComponent(newPrivateProjectDto(db.getDefaultOrganization(), A_PROJECT_UUID).setDbKey(A_PROJECT_KEY));
     loginAsAdmin(db.getDefaultOrganization());
 
     newRequest()
@@ -139,7 +139,7 @@ public class AddGroupActionTest extends BasePermissionWsTest<AddGroupAction> {
   public void add_with_view_uuid() throws Exception {
     OrganizationDto organizationDto = db.getDefaultOrganization();
     GroupDto group = db.users().insertGroup(db.getDefaultOrganization(), "sonar-administrators");
-    ComponentDto view = db.components().insertComponent(newView(organizationDto, "view-uuid").setKey("view-key"));
+    ComponentDto view = db.components().insertComponent(newView(organizationDto, "view-uuid").setDbKey("view-key"));
     loginAsAdmin(db.getDefaultOrganization());
 
     newRequest()
@@ -198,7 +198,7 @@ public class AddGroupActionTest extends BasePermissionWsTest<AddGroupAction> {
     loginAsAdmin(db.getDefaultOrganization());
 
     expectedException.expect(BadRequestException.class);
-    expectedException.expectMessage("Component '" + file.key() + "' (id: " + file.uuid() + ") must be a project or a view.");
+    expectedException.expectMessage("Component '" + file.getDbKey() + "' (id: " + file.uuid() + ") must be a project or a view.");
 
     newRequest()
       .setParam(PARAM_GROUP_NAME, group.getName())
@@ -221,7 +221,7 @@ public class AddGroupActionTest extends BasePermissionWsTest<AddGroupAction> {
   public void adding_a_project_permission_fails_if_component_is_not_a_project() throws Exception {
     OrganizationDto organizationDto = db.getDefaultOrganization();
     GroupDto group = db.users().insertGroup(organizationDto, "sonar-administrators");
-    ComponentDto project = db.components().insertComponent(newPrivateProjectDto(organizationDto, A_PROJECT_UUID).setKey(A_PROJECT_KEY));
+    ComponentDto project = db.components().insertComponent(newPrivateProjectDto(organizationDto, A_PROJECT_UUID).setDbKey(A_PROJECT_KEY));
     ComponentDto file = db.components().insertComponent(ComponentTesting.newFileDto(project, null, "file-uuid"));
     loginAsAdmin(db.getDefaultOrganization());
 
@@ -311,7 +311,7 @@ public class AddGroupActionTest extends BasePermissionWsTest<AddGroupAction> {
       .setParam(PARAM_GROUP_NAME, group.getName())
       .setParam(PARAM_PERMISSION, SYSTEM_ADMIN)
       .setParam(PARAM_PROJECT_ID, project.uuid())
-      .setParam(PARAM_PROJECT_KEY, project.key())
+      .setParam(PARAM_PROJECT_KEY, project.getDbKey())
       .execute();
   }
 
@@ -340,7 +340,7 @@ public class AddGroupActionTest extends BasePermissionWsTest<AddGroupAction> {
     newRequest()
       .setParam(PARAM_GROUP_NAME, group.getName())
       .setParam(PARAM_PERMISSION, PROVISIONING)
-      .setParam(PARAM_PROJECT_KEY, project.key())
+      .setParam(PARAM_PROJECT_KEY, project.getDbKey())
       .execute();
   }
 
index 0731eec4da0c7f775e48f5238704e49bac9d3081..28468181d22d4cf6faa343d81208dedda925f9c6 100644 (file)
@@ -115,7 +115,7 @@ public class AddUserActionTest extends BasePermissionWsTest<AddUserAction> {
 
     newRequest()
       .setParam(PARAM_USER_LOGIN, user.getLogin())
-      .setParam(PARAM_PROJECT_KEY, project.getKey())
+      .setParam(PARAM_PROJECT_KEY, project.getDbKey())
       .setParam(PARAM_PERMISSION, SYSTEM_ADMIN)
       .execute();
 
@@ -125,7 +125,7 @@ public class AddUserActionTest extends BasePermissionWsTest<AddUserAction> {
 
   @Test
   public void add_permission_to_view() throws Exception {
-    ComponentDto view = db.components().insertComponent(newView(db.getDefaultOrganization(), "view-uuid").setKey("view-key"));
+    ComponentDto view = db.components().insertComponent(newView(db.getDefaultOrganization(), "view-uuid").setDbKey("view-key"));
     loginAsAdmin(db.getDefaultOrganization());
 
     newRequest()
@@ -183,7 +183,7 @@ public class AddUserActionTest extends BasePermissionWsTest<AddUserAction> {
     loginAsAdmin(db.getDefaultOrganization());
 
     expectedException.expect(BadRequestException.class);
-    expectedException.expectMessage("Component '" + file.key() + "' (id: " + file.uuid() + ") must be a project or a view.");
+    expectedException.expectMessage("Component '" + file.getDbKey() + "' (id: " + file.uuid() + ") must be a project or a view.");
 
     newRequest()
       .setParam(PARAM_USER_LOGIN, user.getLogin())
@@ -291,7 +291,7 @@ public class AddUserActionTest extends BasePermissionWsTest<AddUserAction> {
     newRequest()
       .setParam(PARAM_USER_LOGIN, user.getLogin())
       .setParam(PARAM_PERMISSION, SYSTEM_ADMIN)
-      .setParam(PARAM_PROJECT_KEY, project.getKey())
+      .setParam(PARAM_PROJECT_KEY, project.getDbKey())
       .execute();
   }
 
@@ -306,7 +306,7 @@ public class AddUserActionTest extends BasePermissionWsTest<AddUserAction> {
 
     newRequest()
       .setParam(PARAM_USER_LOGIN, user.getLogin())
-      .setParam(PARAM_PROJECT_KEY, project.getKey())
+      .setParam(PARAM_PROJECT_KEY, project.getDbKey())
       .setParam(PARAM_PERMISSION, UserRole.ISSUE_ADMIN)
       .execute();
 
@@ -323,7 +323,7 @@ public class AddUserActionTest extends BasePermissionWsTest<AddUserAction> {
 
     newRequest()
       .setParam(PARAM_USER_LOGIN, user.getLogin())
-      .setParam(PARAM_PROJECT_KEY, project.getKey())
+      .setParam(PARAM_PROJECT_KEY, project.getDbKey())
       .setParam(PARAM_ORGANIZATION, "an_org")
       .setParam(PARAM_PERMISSION, ISSUE_ADMIN)
       .execute();
index a911176c5dab4dcbd4a3bd18406ef6adbca5822c..9a9c67ac8357d647fdddb91d9fb2633140e203dc 100644 (file)
@@ -238,7 +238,7 @@ public class GroupsActionTest extends BasePermissionWsTest<GroupsAction> {
 
   @Test
   public void search_groups_on_views() throws Exception {
-    ComponentDto view = db.components().insertComponent(newView(db.getDefaultOrganization(), "view-uuid").setKey("view-key"));
+    ComponentDto view = db.components().insertComponent(newView(db.getDefaultOrganization(), "view-uuid").setDbKey("view-key"));
     GroupDto group = db.users().insertGroup(db.getDefaultOrganization(), "project-group-name");
     db.users().insertProjectPermissionOnGroup(group, ISSUE_ADMIN, view);
 
@@ -277,7 +277,7 @@ public class GroupsActionTest extends BasePermissionWsTest<GroupsAction> {
 
   @Test
   public void fail_if_project_uuid_and_project_key_are_provided() throws Exception {
-    db.components().insertComponent(newPrivateProjectDto(db.organizations().insert(), "project-uuid").setKey("project-key"));
+    db.components().insertComponent(newPrivateProjectDto(db.organizations().insert(), "project-uuid").setDbKey("project-key"));
 
     expectedException.expect(BadRequestException.class);
 
index f4d899075f0c0a0bbdd72db87829cccc610d859d..d6b8f5cc19b8c32b34b53f5e60f21158560149c2 100644 (file)
@@ -140,7 +140,7 @@ public class RemoveGroupActionTest extends BasePermissionWsTest<RemoveGroupActio
 
     newRequest()
       .setParam(PARAM_GROUP_NAME, aGroup.getName())
-      .setParam(PARAM_PROJECT_KEY, project.getKey())
+      .setParam(PARAM_PROJECT_KEY, project.getDbKey())
       .setParam(PARAM_PERMISSION, ADMIN)
       .execute();
 
@@ -216,7 +216,7 @@ public class RemoveGroupActionTest extends BasePermissionWsTest<RemoveGroupActio
     loginAsAdmin(db.getDefaultOrganization());
 
     expectedException.expect(BadRequestException.class);
-    expectedException.expectMessage("Component '" + file.key() + "' (id: " + file.uuid() + ") must be a project or a view.");
+    expectedException.expectMessage("Component '" + file.getDbKey() + "' (id: " + file.uuid() + ") must be a project or a view.");
 
     newRequest()
         .setParam(PARAM_GROUP_NAME, aGroup.getName())
@@ -274,7 +274,7 @@ public class RemoveGroupActionTest extends BasePermissionWsTest<RemoveGroupActio
       .setParam(PARAM_GROUP_NAME, aGroup.getName())
       .setParam(PARAM_PERMISSION, SYSTEM_ADMIN)
       .setParam(PARAM_PROJECT_ID, project.uuid())
-      .setParam(PARAM_PROJECT_KEY, project.getKey())
+      .setParam(PARAM_PROJECT_KEY, project.getDbKey())
       .execute();
   }
 
@@ -315,7 +315,7 @@ public class RemoveGroupActionTest extends BasePermissionWsTest<RemoveGroupActio
     newRequest()
       .setParam(PARAM_GROUP_NAME, aGroup.getName())
       .setParam(PARAM_PERMISSION, PROVISIONING)
-      .setParam(PARAM_PROJECT_KEY, project.key())
+      .setParam(PARAM_PROJECT_KEY, project.getDbKey())
       .execute();
   }
 
index 2e1b2a177a44d222f7ece43e919fb11f3497f634..520f6ee247d9ab0cedbc215ccbefe7ca2e7d39f0 100644 (file)
@@ -101,7 +101,7 @@ public class RemoveUserActionTest extends BasePermissionWsTest<RemoveUserAction>
 
   @Test
   public void remove_permission_from_project() throws Exception {
-    ComponentDto project = db.components().insertComponent(newPrivateProjectDto(db.organizations().insert(), A_PROJECT_UUID).setKey(A_PROJECT_KEY));
+    ComponentDto project = db.components().insertComponent(newPrivateProjectDto(db.organizations().insert(), A_PROJECT_UUID).setDbKey(A_PROJECT_KEY));
     db.users().insertProjectPermissionOnUser(user, CODEVIEWER, project);
     db.users().insertProjectPermissionOnUser(user, ISSUE_ADMIN, project);
     loginAsAdmin(db.getDefaultOrganization());
@@ -117,14 +117,14 @@ public class RemoveUserActionTest extends BasePermissionWsTest<RemoveUserAction>
 
   @Test
   public void remove_with_project_key() throws Exception {
-    ComponentDto project = db.components().insertComponent(newPrivateProjectDto(db.organizations().insert(), A_PROJECT_UUID).setKey(A_PROJECT_KEY));
+    ComponentDto project = db.components().insertComponent(newPrivateProjectDto(db.organizations().insert(), A_PROJECT_UUID).setDbKey(A_PROJECT_KEY));
     db.users().insertProjectPermissionOnUser(user, ISSUE_ADMIN, project);
     db.users().insertProjectPermissionOnUser(user, CODEVIEWER, project);
     loginAsAdmin(db.getDefaultOrganization());
 
     newRequest()
       .setParam(PARAM_USER_LOGIN, user.getLogin())
-      .setParam(PARAM_PROJECT_KEY, project.getKey())
+      .setParam(PARAM_PROJECT_KEY, project.getDbKey())
       .setParam(PARAM_PERMISSION, ISSUE_ADMIN)
       .execute();
 
@@ -133,14 +133,14 @@ public class RemoveUserActionTest extends BasePermissionWsTest<RemoveUserAction>
 
   @Test
   public void remove_with_view_uuid() throws Exception {
-    ComponentDto view = db.components().insertComponent(newView(db.organizations().insert(), "view-uuid").setKey("view-key"));
+    ComponentDto view = db.components().insertComponent(newView(db.organizations().insert(), "view-uuid").setDbKey("view-key"));
     db.users().insertProjectPermissionOnUser(user, ISSUE_ADMIN, view);
     db.users().insertProjectPermissionOnUser(user, ADMIN, view);
     loginAsAdmin(db.getDefaultOrganization());
 
     newRequest()
       .setParam(PARAM_USER_LOGIN, user.getLogin())
-      .setParam(PARAM_PROJECT_KEY, view.getKey())
+      .setParam(PARAM_PROJECT_KEY, view.getDbKey())
       .setParam(PARAM_PERMISSION, ISSUE_ADMIN)
       .execute();
 
@@ -204,7 +204,7 @@ public class RemoveUserActionTest extends BasePermissionWsTest<RemoveUserAction>
     loginAsAdmin(db.getDefaultOrganization());
 
     expectedException.expect(BadRequestException.class);
-    expectedException.expectMessage("Component '" + file.key() + "' (id: " + file.uuid() + ") must be a project or a view.");
+    expectedException.expectMessage("Component '" + file.getDbKey() + "' (id: " + file.uuid() + ") must be a project or a view.");
 
     newRequest()
       .setParam(PARAM_USER_LOGIN, user.getLogin())
@@ -250,7 +250,7 @@ public class RemoveUserActionTest extends BasePermissionWsTest<RemoveUserAction>
 
   @Test
   public void fail_when_project_uuid_and_project_key_are_provided() throws Exception {
-    ComponentDto project = db.components().insertComponent(newPrivateProjectDto(db.organizations().insert(), A_PROJECT_UUID).setKey(A_PROJECT_KEY));
+    ComponentDto project = db.components().insertComponent(newPrivateProjectDto(db.organizations().insert(), A_PROJECT_UUID).setDbKey(A_PROJECT_KEY));
     loginAsAdmin(db.getDefaultOrganization());
 
     expectedException.expect(BadRequestException.class);
@@ -260,7 +260,7 @@ public class RemoveUserActionTest extends BasePermissionWsTest<RemoveUserAction>
       .setParam(PARAM_PERMISSION, SYSTEM_ADMIN)
       .setParam(PARAM_USER_LOGIN, user.getLogin())
       .setParam(PARAM_PROJECT_ID, project.uuid())
-      .setParam(PARAM_PROJECT_KEY, project.getKey())
+      .setParam(PARAM_PROJECT_KEY, project.getDbKey())
       .execute();
   }
 
@@ -286,7 +286,7 @@ public class RemoveUserActionTest extends BasePermissionWsTest<RemoveUserAction>
     newRequest()
       .setParam(PARAM_USER_LOGIN, user.getLogin())
       .setParam(PARAM_PERMISSION, ISSUE_ADMIN)
-      .setParam(PARAM_PROJECT_KEY, project.key())
+      .setParam(PARAM_PROJECT_KEY, project.getDbKey())
       .execute();
   }
 
index 5310bad293d67abeb52ceb9e179a4dd457e28b25..c60004c1900277f7a348e1758845aea49e59c742 100644 (file)
@@ -84,7 +84,7 @@ public class SearchProjectPermissionsActionTest extends BasePermissionWsTest<Sea
         "  \"projects\": [" +
         "    {" +
         "      \"id\": \"" + project.uuid() + "\"," +
-        "      \"key\": \"" + project.key() + "\"," +
+        "      \"key\": \"" + project.getDbKey() + "\"," +
         "      \"name\": \"" + project.name() + "\"," +
         "      \"qualifier\": \"TRK\"," +
         "      \"permissions\": []" +
@@ -110,7 +110,7 @@ public class SearchProjectPermissionsActionTest extends BasePermissionWsTest<Sea
         "  \"projects\": [" +
         "    {" +
         "      \"id\": \"" + project.uuid() + "\"," +
-        "      \"key\": \"" + project.key() + "\"," +
+        "      \"key\": \"" + project.getDbKey() + "\"," +
         "      \"name\": \"" + project.name() + "\"," +
         "      \"qualifier\": \"TRK\"," +
         "      \"permissions\": []" +
@@ -213,8 +213,8 @@ public class SearchProjectPermissionsActionTest extends BasePermissionWsTest<Sea
   @Test
   public void search_by_query_on_key_must_match_exactly() throws Exception {
     OrganizationDto organizationDto = db.organizations().insert();
-    componentDb.insertProjectAndSnapshot(ComponentTesting.newPrivateProjectDto(organizationDto).setKey("project-key"));
-    componentDb.insertProjectAndSnapshot(ComponentTesting.newPrivateProjectDto(organizationDto).setKey("another-key"));
+    componentDb.insertProjectAndSnapshot(ComponentTesting.newPrivateProjectDto(organizationDto).setDbKey("project-key"));
+    componentDb.insertProjectAndSnapshot(ComponentTesting.newPrivateProjectDto(organizationDto).setDbKey("another-key"));
 
     String result = newRequest()
       .setParam(TEXT_QUERY, "project-key")
@@ -287,7 +287,7 @@ public class SearchProjectPermissionsActionTest extends BasePermissionWsTest<Sea
     return db.components().insertComponent(newView(db.getDefaultOrganization())
       .setUuid("752d8bfd-420c-4a83-a4e5-8ab19b13c8fc")
       .setName("Java")
-      .setKey("Java"));
+      .setDbKey("Java"));
   }
 
   private ComponentDto insertProjectInView(ComponentDto project, ComponentDto view) {
@@ -297,14 +297,14 @@ public class SearchProjectPermissionsActionTest extends BasePermissionWsTest<Sea
   private ComponentDto insertClang() {
     return db.components().insertComponent(newPrivateProjectDto(db.getDefaultOrganization(), "project-uuid-2")
       .setName("Clang")
-      .setKey("clang")
+      .setDbKey("clang")
       .setUuid("ce4c03d6-430f-40a9-b777-ad877c00aa4d"));
   }
 
   private ComponentDto insertJdk7() {
     return db.components().insertComponent(ComponentTesting.newPublicProjectDto(db.getDefaultOrganization())
       .setName("JDK 7")
-      .setKey("net.java.openjdk:jdk7")
+      .setDbKey("net.java.openjdk:jdk7")
       .setUuid("0bd7b1e7-91d6-439e-a607-4a3a9aad3c6a"));
   }
 }
index 092802f619df32ba220261e34fa6a44f86b2b5d8..d66cc49bdd5fa3012922120e885a39a30c6b3ca7 100644 (file)
@@ -324,7 +324,7 @@ public class UsersActionTest extends BasePermissionWsTest<UsersAction> {
 
   @Test
   public void fail_if_project_uuid_and_project_key_are_provided() throws Exception {
-    db.components().insertComponent(newPrivateProjectDto(db.organizations().insert(), "project-uuid").setKey("project-key"));
+    db.components().insertComponent(newPrivateProjectDto(db.organizations().insert(), "project-uuid").setDbKey("project-key"));
     loginAsAdmin(db.getDefaultOrganization());
 
     expectedException.expect(BadRequestException.class);
index 62bd1caa1c8939cef51198f27800a813bd24e49c..5949e9ad88297128120a4193c42190e9613951c6 100644 (file)
@@ -120,7 +120,7 @@ public class ApplyTemplateActionTest extends BasePermissionWsTest<ApplyTemplateA
   public void apply_template_with_project_key() throws Exception {
     loginAsAdmin(db.getDefaultOrganization());
 
-    newRequest(template1.getUuid(), null, project.key());
+    newRequest(template1.getUuid(), null, project.getDbKey());
 
     assertTemplate1AppliedToProject();
   }
index ed3bebb972bff324f8d23de159341ff073ea09bd..18a6b2423c747b4bf224cc6131d26dfb3ce748cf 100644 (file)
@@ -159,12 +159,12 @@ public class BulkApplyTemplateActionTest extends BasePermissionWsTest<BulkApplyT
 
   @Test
   public void apply_template_by_query_on_name_and_key_public_project() throws Exception {
-    ComponentDto publicProjectFoundByKey = ComponentTesting.newPublicProjectDto(organization).setKey("sonar");
+    ComponentDto publicProjectFoundByKey = ComponentTesting.newPublicProjectDto(organization).setDbKey("sonar");
     db.components().insertProjectAndSnapshot(publicProjectFoundByKey);
     ComponentDto publicProjectFoundByName = ComponentTesting.newPublicProjectDto(organization).setName("name-sonar-name");
     db.components().insertProjectAndSnapshot(publicProjectFoundByName);
     // match must be exact on key
-    ComponentDto projectUntouched = ComponentTesting.newPublicProjectDto(organization).setKey("new-sonar").setName("project-name");
+    ComponentDto projectUntouched = ComponentTesting.newPublicProjectDto(organization).setDbKey("new-sonar").setName("project-name");
     db.components().insertProjectAndSnapshot(projectUntouched);
     loginAsAdmin(organization);
 
@@ -180,12 +180,12 @@ public class BulkApplyTemplateActionTest extends BasePermissionWsTest<BulkApplyT
 
   @Test
   public void apply_template_by_query_on_name_and_key() throws Exception {
-    ComponentDto privateProjectFoundByKey = ComponentTesting.newPrivateProjectDto(organization).setKey("sonar");
+    ComponentDto privateProjectFoundByKey = ComponentTesting.newPrivateProjectDto(organization).setDbKey("sonar");
     db.components().insertProjectAndSnapshot(privateProjectFoundByKey);
     ComponentDto privateProjectFoundByName = ComponentTesting.newPrivateProjectDto(organization).setName("name-sonar-name");
     db.components().insertProjectAndSnapshot(privateProjectFoundByName);
     // match must be exact on key
-    ComponentDto projectUntouched = ComponentTesting.newPublicProjectDto(organization).setKey("new-sonar").setName("project-name");
+    ComponentDto projectUntouched = ComponentTesting.newPublicProjectDto(organization).setDbKey("new-sonar").setName("project-name");
     db.components().insertProjectAndSnapshot(projectUntouched);
     loginAsAdmin(organization);
 
index acada2ea8f320d52dc121a2f3bc8e1a1e11045e5..0ca7c7f2886d533a65601530c2697aaaadf73adf 100644 (file)
@@ -95,7 +95,7 @@ public class BulkDeleteActionTest {
     ComponentDto toKeep = db.components().insertPrivateProject(org2);
 
     WsTester.Result result = ws.newPostRequest("api/projects", ACTION)
-      .setParam("keys", toDeleteInOrg1.key() + "," + toDeleteInOrg2.key())
+      .setParam("keys", toDeleteInOrg1.getDbKey() + "," + toDeleteInOrg2.getDbKey())
       .execute();
     result.assertNoContent();
 
@@ -109,7 +109,7 @@ public class BulkDeleteActionTest {
     ComponentDto toDelete2 = db.components().insertPrivateProject(org1);
 
     WsTester.Result result = ws.newPostRequest("api/projects", ACTION)
-      .setParam("keys", toDelete1.key() + ",missing," + toDelete2.key() + ",doesNotExist")
+      .setParam("keys", toDelete1.getDbKey() + ",missing," + toDelete2.getDbKey() + ",doesNotExist")
       .execute();
     result.assertNoContent();
 
@@ -125,7 +125,7 @@ public class BulkDeleteActionTest {
     expectedException.expectMessage("Insufficient privileges");
 
     ws.newPostRequest("api/projects", ACTION)
-      .setParam("keys", project.key())
+      .setParam("keys", project.getDbKey())
       .execute();
 
     verifyNoDeletions();
@@ -139,7 +139,7 @@ public class BulkDeleteActionTest {
 
     WsTester.Result result = ws.newPostRequest("api/projects", ACTION)
       .setParam("organization", org1.getKey())
-      .setParam("keys", toDelete.key() + "," + cantBeDeleted.key())
+      .setParam("keys", toDelete.getDbKey() + "," + cantBeDeleted.getDbKey())
       .execute();
     result.assertNoContent();
 
index 632813f071f1ef929ef39b7e1a12f9ae08d26809..5d470c0cbe231370720620c58296b71b1d072829 100644 (file)
@@ -97,11 +97,11 @@ public class BulkUpdateKeyActionTest {
   @Test
   public void json_example() {
     OrganizationDto organizationDto = db.organizations().insert();
-    ComponentDto project = componentDb.insertComponent(ComponentTesting.newPrivateProjectDto(organizationDto).setKey("my_project"));
-    componentDb.insertComponent(newModuleDto(project).setKey("my_project:module_1"));
-    ComponentDto anotherProject = componentDb.insertComponent(ComponentTesting.newPrivateProjectDto(organizationDto).setKey("another_project"));
-    componentDb.insertComponent(newModuleDto(anotherProject).setKey("my_new_project:module_1"));
-    ComponentDto module2 = componentDb.insertComponent(newModuleDto(project).setKey("my_project:module_2"));
+    ComponentDto project = componentDb.insertComponent(ComponentTesting.newPrivateProjectDto(organizationDto).setDbKey("my_project"));
+    componentDb.insertComponent(newModuleDto(project).setDbKey("my_project:module_1"));
+    ComponentDto anotherProject = componentDb.insertComponent(ComponentTesting.newPrivateProjectDto(organizationDto).setDbKey("another_project"));
+    componentDb.insertComponent(newModuleDto(anotherProject).setDbKey("my_new_project:module_1"));
+    ComponentDto module2 = componentDb.insertComponent(newModuleDto(project).setDbKey("my_project:module_2"));
     componentDb.insertComponent(newFileDto(module2, null));
 
     String result = ws.newRequest()
@@ -127,18 +127,18 @@ public class BulkUpdateKeyActionTest {
   @Test
   public void bulk_update_project_key() {
     ComponentDto project = insertMyProject();
-    ComponentDto module = componentDb.insertComponent(newModuleDto(project).setKey("my_project:root:module"));
-    ComponentDto inactiveModule = componentDb.insertComponent(newModuleDto(project).setKey("my_project:root:inactive_module").setEnabled(false));
-    ComponentDto file = componentDb.insertComponent(newFileDto(module, null).setKey("my_project:root:module:src/File.xoo"));
-    ComponentDto inactiveFile = componentDb.insertComponent(newFileDto(module, null).setKey("my_project:root:module:src/InactiveFile.xoo").setEnabled(false));
+    ComponentDto module = componentDb.insertComponent(newModuleDto(project).setDbKey("my_project:root:module"));
+    ComponentDto inactiveModule = componentDb.insertComponent(newModuleDto(project).setDbKey("my_project:root:inactive_module").setEnabled(false));
+    ComponentDto file = componentDb.insertComponent(newFileDto(module, null).setDbKey("my_project:root:module:src/File.xoo"));
+    ComponentDto inactiveFile = componentDb.insertComponent(newFileDto(module, null).setDbKey("my_project:root:module:src/InactiveFile.xoo").setEnabled(false));
 
     BulkUpdateKeyWsResponse result = callByUuid(project.uuid(), FROM, TO);
 
     assertThat(result.getKeysCount()).isEqualTo(2);
     assertThat(result.getKeysList()).extracting(Key::getKey, Key::getNewKey, Key::getDuplicate)
       .containsExactly(
-        tuple(project.key(), "your_project", false),
-        tuple(module.key(), "your_project:root:module", false));
+        tuple(project.getDbKey(), "your_project", false),
+        tuple(module.getDbKey(), "your_project:root:module", false));
 
     verify(componentService).bulkUpdateKey(any(DbSession.class), eq(project), eq(FROM), eq(TO));
   }
@@ -148,15 +148,15 @@ public class BulkUpdateKeyActionTest {
     String newKey = "provisionedProject2";
     ComponentDto provisionedProject = componentDb.insertPrivateProject();
 
-    callByKey(provisionedProject.key(), provisionedProject.getKey(), newKey);
+    callByKey(provisionedProject.getDbKey(), provisionedProject.getDbKey(), newKey);
 
-    verify(componentService).bulkUpdateKey(any(DbSession.class), eq(provisionedProject), eq(provisionedProject.getKey()), eq(newKey));
+    verify(componentService).bulkUpdateKey(any(DbSession.class), eq(provisionedProject), eq(provisionedProject.getDbKey()), eq(newKey));
   }
 
   @Test
   public void fail_to_bulk_if_a_component_already_exists_with_the_same_key() {
-    componentDb.insertComponent(ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("my_project"));
-    componentDb.insertComponent(ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("your_project"));
+    componentDb.insertComponent(ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("my_project"));
+    componentDb.insertComponent(ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("your_project"));
 
     expectedException.expect(BadRequestException.class);
     expectedException.expectMessage("Impossible to update key: a component with key \"your_project\" already exists.");
@@ -192,7 +192,7 @@ public class BulkUpdateKeyActionTest {
     expectedException.expect(IllegalArgumentException.class);
     expectedException.expectMessage("Component updated must be a module or a key");
 
-    callByKey(file.key(), FROM, TO);
+    callByKey(file.getDbKey(), FROM, TO);
   }
 
   @Test
@@ -201,7 +201,7 @@ public class BulkUpdateKeyActionTest {
 
     ComponentDto project = insertMyProject();
 
-    callDryRunByKey(project.key(), null, TO);
+    callDryRunByKey(project.getDbKey(), null, TO);
   }
 
   @Test
@@ -210,7 +210,7 @@ public class BulkUpdateKeyActionTest {
 
     ComponentDto project = insertMyProject();
 
-    callDryRunByKey(project.key(), FROM, null);
+    callDryRunByKey(project.getDbKey(), FROM, null);
   }
 
   @Test
@@ -226,7 +226,7 @@ public class BulkUpdateKeyActionTest {
 
     ComponentDto project = insertMyProject();
 
-    call(project.uuid(), project.key(), FROM, TO, false);
+    call(project.uuid(), project.getDbKey(), FROM, TO, false);
   }
 
   @Test
@@ -260,7 +260,7 @@ public class BulkUpdateKeyActionTest {
   }
 
   private ComponentDto insertMyProject() {
-    return componentDb.insertComponent(ComponentTesting.newPrivateProjectDto(db.organizations().insert()).setKey(MY_PROJECT_KEY));
+    return componentDb.insertComponent(ComponentTesting.newPrivateProjectDto(db.organizations().insert()).setDbKey(MY_PROJECT_KEY));
   }
 
   private BulkUpdateKeyWsResponse callDryRunByUuid(@Nullable String uuid, @Nullable String from, @Nullable String to) {
index c661569fc45f970f7fd029528a1083c67cd904d9..c9d7e3013e4609b1edd40dc0bb0914ab9c957ff9 100644 (file)
@@ -104,7 +104,7 @@ public class CreateActionTest {
       .extracting(Project::getKey, Project::getName, Project::getQualifier, Project::getVisibility)
       .containsOnly(DEFAULT_PROJECT_KEY, DEFAULT_PROJECT_NAME, "TRK", "public");
     assertThat(db.getDbClient().componentDao().selectByKey(db.getSession(), DEFAULT_PROJECT_KEY).get())
-      .extracting(ComponentDto::getKey, ComponentDto::name, ComponentDto::qualifier, ComponentDto::scope, ComponentDto::isPrivate)
+      .extracting(ComponentDto::getDbKey, ComponentDto::name, ComponentDto::qualifier, ComponentDto::scope, ComponentDto::isPrivate)
       .containsOnly(DEFAULT_PROJECT_KEY, DEFAULT_PROJECT_NAME, "TRK", "PRJ", false);
   }
 
@@ -238,7 +238,7 @@ public class CreateActionTest {
   @Test
   public void fail_when_project_already_exists() throws Exception {
     OrganizationDto organization = db.organizations().insert();
-    db.components().insertPublicProject(project -> project.setKey(DEFAULT_PROJECT_KEY));
+    db.components().insertPublicProject(project -> project.setDbKey(DEFAULT_PROJECT_KEY));
     userSession.addPermission(PROVISION_PROJECTS, organization);
 
     expectedException.expect(BadRequestException.class);
index eb40ddaf9de363ad32e2dcf75a8e98c7a25aa41a..73442dcf0c5543d65654ddd3f2329d0439e5c84e 100644 (file)
@@ -83,7 +83,7 @@ public class DeleteActionTest {
     WsTester.TestRequest request = newRequest().setParam(PARAM_PROJECT_ID, project.uuid());
     call(request);
 
-    assertThat(verifyDeletedKey()).isEqualTo(project.key());
+    assertThat(verifyDeletedKey()).isEqualTo(project.getDbKey());
   }
 
   @Test
@@ -91,15 +91,15 @@ public class DeleteActionTest {
     ComponentDto project = componentDbTester.insertPrivateProject();
     userSessionRule.logIn().addPermission(ADMINISTER, project.getOrganizationUuid());
 
-    call(newRequest().setParam(PARAM_PROJECT, project.key()));
+    call(newRequest().setParam(PARAM_PROJECT, project.getDbKey()));
 
-    assertThat(verifyDeletedKey()).isEqualTo(project.key());
+    assertThat(verifyDeletedKey()).isEqualTo(project.getDbKey());
   }
 
   private String verifyDeletedKey() {
     ArgumentCaptor<ComponentDto> argument = ArgumentCaptor.forClass(ComponentDto.class);
     verify(componentCleanerService).delete(any(DbSession.class), argument.capture());
-    return argument.getValue().key();
+    return argument.getValue().getDbKey();
   }
 
   @Test
@@ -109,7 +109,7 @@ public class DeleteActionTest {
 
     call(newRequest().setParam(PARAM_PROJECT_ID, project.uuid()));
 
-    assertThat(verifyDeletedKey()).isEqualTo(project.key());
+    assertThat(verifyDeletedKey()).isEqualTo(project.getDbKey());
   }
 
   @Test
@@ -117,9 +117,9 @@ public class DeleteActionTest {
     ComponentDto project = componentDbTester.insertPrivateProject();
     userSessionRule.logIn().addProjectPermission(UserRole.ADMIN, project);
 
-    call(newRequest().setParam(PARAM_PROJECT, project.key()));
+    call(newRequest().setParam(PARAM_PROJECT, project.getDbKey()));
 
-    assertThat(verifyDeletedKey()).isEqualTo(project.key());
+    assertThat(verifyDeletedKey()).isEqualTo(project.getDbKey());
   }
 
   @Test
index 1e517907272bd2eaab1901b7b58030f83e4d6d77..c04ed17e84a79e3b711da842f519ad3091d16f20 100644 (file)
@@ -95,13 +95,13 @@ public class GhostsActionTest {
       "  \"projects\": [" +
       "    {" +
       "      \"uuid\": \"" + ghost1.uuid() + "\"," +
-      "      \"key\": \"" + ghost1.key() + "\"," +
+      "      \"key\": \"" + ghost1.getDbKey() + "\"," +
       "      \"name\": \"" + ghost1.name() + "\"," +
       "      \"visibility\": \"private\"" +
       "    }," +
       "    {" +
       "      \"uuid\": \"" + ghost2.uuid() + "\"," +
-      "      \"key\": \"" + ghost2.key() + "\"," +
+      "      \"key\": \"" + ghost2.getDbKey() + "\"," +
       "      \"name\": \"" + ghost2.name() + "\"," +
       "      \"visibility\": \"private\"" +
       "    }" +
@@ -115,7 +115,7 @@ public class GhostsActionTest {
     OrganizationDto organization = db.organizations().insert();
     for (int i = 1; i <= 10; i++) {
       int count = i;
-      insertGhostProject(organization, dto -> dto.setKey("ghost-key-" + count));
+      insertGhostProject(organization, dto -> dto.setDbKey("ghost-key-" + count));
     }
     userSessionRule.logIn().addPermission(ADMINISTER, organization);
 
@@ -173,7 +173,7 @@ public class GhostsActionTest {
   @Test
   public void ghost_projects_with_partial_query_on_key() throws Exception {
     OrganizationDto organization = db.organizations().insert();
-    insertGhostProject(organization, dto -> dto.setKey("ghost-key-1"));
+    insertGhostProject(organization, dto -> dto.setDbKey("ghost-key-1"));
 
     userSessionRule.logIn().addPermission(ADMINISTER, organization);
 
@@ -190,7 +190,7 @@ public class GhostsActionTest {
   public void ghost_projects_base_on_json_example() throws Exception {
     OrganizationDto organization = db.organizations().insert();
     ComponentDto hBaseProject = ComponentTesting.newPrivateProjectDto(organization, "ce4c03d6-430f-40a9-b777-ad877c00aa4d")
-      .setKey("org.apache.hbas:hbase")
+      .setDbKey("org.apache.hbas:hbase")
       .setName("HBase")
       .setCreatedAt(DateUtils.parseDateTime("2015-03-04T23:03:44+0100"))
       .setPrivate(false);
@@ -198,7 +198,7 @@ public class GhostsActionTest {
     dbClient.snapshotDao().insert(db.getSession(), SnapshotTesting.newAnalysis(hBaseProject)
       .setStatus(STATUS_UNPROCESSED));
     ComponentDto roslynProject = ComponentTesting.newPrivateProjectDto(organization, "c526ef20-131b-4486-9357-063fa64b5079")
-      .setKey("com.microsoft.roslyn:roslyn")
+      .setDbKey("com.microsoft.roslyn:roslyn")
       .setName("Roslyn")
       .setCreatedAt(DateUtils.parseDateTime("2013-03-04T23:03:44+0100"));
     dbClient.componentDao().insert(db.getSession(), roslynProject);
index 8c321b2e9cdffe69cb4b5a5c17a033748870dbbd..d8b706ee83604cd8806a8cd1313a253772bea0bc 100644 (file)
@@ -68,9 +68,9 @@ public class IndexActionTest {
   @Test
   public void search_all_projects() throws Exception {
     insertProjectsAuthorizedForUser(
-      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("org.jenkins-ci.plugins:sonar").setName("Jenkins Sonar Plugin"),
-      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("org.codehaus.sonar-plugins:sonar-ant-task").setName("Sonar Ant Task"),
-      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("org.codehaus.sonar-plugins:sonar-build-breaker-plugin").setName("Sonar Build Breaker Plugin"));
+      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("org.jenkins-ci.plugins:sonar").setName("Jenkins Sonar Plugin"),
+      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("org.codehaus.sonar-plugins:sonar-ant-task").setName("Sonar Ant Task"),
+      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("org.codehaus.sonar-plugins:sonar-build-breaker-plugin").setName("Sonar Build Breaker Plugin"));
 
     String result = call(null, null, null);
 
@@ -79,12 +79,12 @@ public class IndexActionTest {
 
   @Test
   public void search_projects_with_modules() throws Exception {
-    ComponentDto project1 = ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("org.jenkins-ci.plugins:sonar").setName("Jenkins Sonar Plugin");
-    ComponentDto project2 = ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("org.codehaus.sonar-plugins:sonar-ant-task").setName("Sonar Ant Task");
+    ComponentDto project1 = ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("org.jenkins-ci.plugins:sonar").setName("Jenkins Sonar Plugin");
+    ComponentDto project2 = ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("org.codehaus.sonar-plugins:sonar-ant-task").setName("Sonar Ant Task");
     insertProjectsAuthorizedForUser(project1, project2);
     db.components().insertComponents(
-      newModuleDto(project1).setKey("org.jenkins-ci.plugins:sonar-common").setName("Common"),
-      newModuleDto(project2).setKey("org.codehaus.sonar-plugins:sonar-ant-db").setName("Ant DB"));
+      newModuleDto(project1).setDbKey("org.jenkins-ci.plugins:sonar-common").setName("Common"),
+      newModuleDto(project2).setDbKey("org.codehaus.sonar-plugins:sonar-ant-db").setName("Ant DB"));
 
     String result = call(null, null, true);
 
@@ -94,9 +94,9 @@ public class IndexActionTest {
   @Test
   public void search_project_by_key() throws Exception {
     insertProjectsAuthorizedForUser(
-      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("org.jenkins-ci.plugins:sonar").setName("Jenkins Sonar Plugin"),
-      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("org.codehaus.sonar-plugins:sonar-ant-task").setName("Sonar Ant Task"),
-      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("org.codehaus.sonar-plugins:sonar-build-breaker-plugin").setName("Sonar Build Breaker Plugin"));
+      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("org.jenkins-ci.plugins:sonar").setName("Jenkins Sonar Plugin"),
+      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("org.codehaus.sonar-plugins:sonar-ant-task").setName("Sonar Ant Task"),
+      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("org.codehaus.sonar-plugins:sonar-build-breaker-plugin").setName("Sonar Build Breaker Plugin"));
 
     String result = call("org.jenkins-ci.plugins:sonar", null, null);
 
@@ -105,11 +105,11 @@ public class IndexActionTest {
 
   @Test
   public void search_project_by_id() throws Exception {
-    ComponentDto project = ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("org.jenkins-ci.plugins:sonar").setName("Jenkins Sonar Plugin");
+    ComponentDto project = ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("org.jenkins-ci.plugins:sonar").setName("Jenkins Sonar Plugin");
     insertProjectsAuthorizedForUser(
       project,
-      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("org.codehaus.sonar-plugins:sonar-ant-task").setName("Sonar Ant Task"),
-      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("org.codehaus.sonar-plugins:sonar-build-breaker-plugin").setName("Sonar Build Breaker Plugin"));
+      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("org.codehaus.sonar-plugins:sonar-ant-task").setName("Sonar Ant Task"),
+      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("org.codehaus.sonar-plugins:sonar-build-breaker-plugin").setName("Sonar Build Breaker Plugin"));
 
     String result = call(Long.toString(project.getId()), null, null);
 
@@ -119,9 +119,9 @@ public class IndexActionTest {
   @Test
   public void search_projects_by_name() throws Exception {
     insertProjectsAuthorizedForUser(
-      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("org.jenkins-ci.plugins:sonar").setName("Jenkins Sonar Plugin"),
-      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("org.codehaus.sonar-plugins:sonar-ant-task").setName("Sonar Ant Task"),
-      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("org.codehaus.sonar-plugins:sonar-build-breaker-plugin").setName("Sonar Build Breaker Plugin"));
+      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("org.jenkins-ci.plugins:sonar").setName("Jenkins Sonar Plugin"),
+      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("org.codehaus.sonar-plugins:sonar-ant-task").setName("Sonar Ant Task"),
+      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("org.codehaus.sonar-plugins:sonar-build-breaker-plugin").setName("Sonar Build Breaker Plugin"));
 
     String result = call(null, "Plu", null);
 
@@ -130,13 +130,13 @@ public class IndexActionTest {
 
   @Test
   public void search_projects_with_modules_by_name() throws Exception {
-    ComponentDto project1 = ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("org.jenkins-ci.plugins:sonar").setName("Jenkins Sonar Plugin");
-    ComponentDto project2 = ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("org.codehaus.sonar-plugins:sonar-ant-task").setName("Sonar Ant Task");
+    ComponentDto project1 = ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("org.jenkins-ci.plugins:sonar").setName("Jenkins Sonar Plugin");
+    ComponentDto project2 = ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("org.codehaus.sonar-plugins:sonar-ant-task").setName("Sonar Ant Task");
     insertProjectsAuthorizedForUser(project1, project2);
     db.components().insertComponents(
-      newModuleDto(project1).setKey("org.jenkins-ci.plugins:sonar-common-db").setName("Jenkins Common DB"),
-      newModuleDto(project1).setKey("org.jenkins-ci.plugins:sonar-common-server").setName("Jenkins Common Server"),
-      newModuleDto(project2).setKey("org.codehaus.sonar-plugins:sonar-ant-db").setName("Ant DB"));
+      newModuleDto(project1).setDbKey("org.jenkins-ci.plugins:sonar-common-db").setName("Jenkins Common DB"),
+      newModuleDto(project1).setDbKey("org.jenkins-ci.plugins:sonar-common-server").setName("Jenkins Common Server"),
+      newModuleDto(project2).setDbKey("org.codehaus.sonar-plugins:sonar-ant-db").setName("Ant DB"));
 
     String result = call(null, "Com", true);
 
@@ -146,9 +146,9 @@ public class IndexActionTest {
   @Test
   public void return_empty_list_when_no_project_match_search() throws Exception {
     insertProjectsAuthorizedForUser(
-      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("org.jenkins-ci.plugins:sonar").setName("Jenkins Sonar Plugin"),
-      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("org.codehaus.sonar-plugins:sonar-ant-task").setName("Sonar Ant Task"),
-      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("org.codehaus.sonar-plugins:sonar-build-breaker-plugin").setName("Sonar Build Breaker Plugin"));
+      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("org.jenkins-ci.plugins:sonar").setName("Jenkins Sonar Plugin"),
+      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("org.codehaus.sonar-plugins:sonar-ant-task").setName("Sonar Ant Task"),
+      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("org.codehaus.sonar-plugins:sonar-build-breaker-plugin").setName("Sonar Build Breaker Plugin"));
 
     String result = call(null, "Unknown", null);
 
@@ -158,10 +158,10 @@ public class IndexActionTest {
   @Test
   public void return_only_projects_authorized_for_user() throws Exception {
     insertProjectsAuthorizedForUser(
-      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("org.jenkins-ci.plugins:sonar").setName("Jenkins Sonar Plugin"),
-      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("org.codehaus.sonar-plugins:sonar-ant-task").setName("Sonar Ant Task"));
+      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("org.jenkins-ci.plugins:sonar").setName("Jenkins Sonar Plugin"),
+      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("org.codehaus.sonar-plugins:sonar-ant-task").setName("Sonar Ant Task"));
     db.components()
-      .insertComponent(ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("org.codehaus.sonar-plugins:sonar-build-breaker-plugin").setName("Sonar Build Breaker Plugin"));
+      .insertComponent(ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("org.codehaus.sonar-plugins:sonar-build-breaker-plugin").setName("Sonar Build Breaker Plugin"));
 
     String result = call(null, null, null);
 
@@ -170,7 +170,7 @@ public class IndexActionTest {
 
   @Test
   public void do_not_verify_permissions_if_user_is_root() throws Exception {
-    ComponentDto project = db.components().insertPrivateProject(p -> p.setKey("P1").setName("POne"));
+    ComponentDto project = db.components().insertPrivateProject(p -> p.setDbKey("P1").setName("POne"));
 
     String result = call(null, null, null);
 
@@ -193,9 +193,9 @@ public class IndexActionTest {
   @Test
   public void test_example() {
     insertProjectsAuthorizedForUser(
-      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("org.jenkins-ci.plugins:sonar").setName("Jenkins Sonar Plugin"),
-      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("org.codehaus.sonar-plugins:sonar-ant-task").setName("Sonar Ant Task"),
-      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("org.codehaus.sonar-plugins:sonar-build-breaker-plugin").setName("Sonar Build Breaker Plugin"));
+      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("org.jenkins-ci.plugins:sonar").setName("Jenkins Sonar Plugin"),
+      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("org.codehaus.sonar-plugins:sonar-ant-task").setName("Sonar Ant Task"),
+      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("org.codehaus.sonar-plugins:sonar-build-breaker-plugin").setName("Sonar Build Breaker Plugin"));
 
     String result = call(null, null, null);
 
index a1e95d7ffe7adcc6156a64464529165a6b138fdd..c9141745a56e937824175e6dcc90d083542a00a4 100644 (file)
@@ -174,12 +174,12 @@ public class ProvisionedActionTest {
   public void provisioned_projects_as_defined_in_the_example() throws Exception {
     OrganizationDto org = db.organizations().insert();
     ComponentDto hBaseProject = ComponentTesting.newPrivateProjectDto(org, "ce4c03d6-430f-40a9-b777-ad877c00aa4d")
-      .setKey("org.apache.hbas:hbase")
+      .setDbKey("org.apache.hbas:hbase")
       .setName("HBase")
       .setCreatedAt(DateUtils.parseDateTime("2015-03-04T23:03:44+0100"))
       .setPrivate(false);
     ComponentDto roslynProject = ComponentTesting.newPrivateProjectDto(org, "c526ef20-131b-4486-9357-063fa64b5079")
-      .setKey("com.microsoft.roslyn:roslyn")
+      .setDbKey("com.microsoft.roslyn:roslyn")
       .setName("Roslyn")
       .setCreatedAt(DateUtils.parseDateTime("2013-03-04T23:03:44+0100"));
     db.components().insertComponents(hBaseProject, roslynProject);
@@ -220,6 +220,6 @@ public class ProvisionedActionTest {
     return ComponentTesting
       .newPrivateProjectDto(organizationDto, "provisioned-uuid-" + uuid)
       .setName("provisioned-name-" + uuid)
-      .setKey("provisioned-key-" + uuid);
+      .setDbKey("provisioned-key-" + uuid);
   }
 }
index 852f48c82aa664cc77f6c82b87c1978bb434f4bd..658e15e48af72836c400b7b913ad4ee9fa6e495f 100644 (file)
@@ -90,8 +90,8 @@ public class SearchActionTest {
   public void search_by_key_query() throws IOException {
     userSession.addPermission(ADMINISTER, db.getDefaultOrganization());
     db.components().insertComponents(
-      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("project-_%-key"),
-      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("project-key-without-escaped-characters"));
+      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("project-_%-key"),
+      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("project-key-without-escaped-characters"));
 
     SearchWsResponse response = call(SearchWsRequest.builder().setQuery("project-_%-key").build());
 
@@ -102,8 +102,8 @@ public class SearchActionTest {
   public void search_private_projects() {
     userSession.addPermission(ADMINISTER, db.getDefaultOrganization());
     db.components().insertComponents(
-      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("private-key"),
-      ComponentTesting.newPublicProjectDto(db.getDefaultOrganization()).setKey("public-key"));
+      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("private-key"),
+      ComponentTesting.newPublicProjectDto(db.getDefaultOrganization()).setDbKey("public-key"));
 
     SearchWsResponse response = call(SearchWsRequest.builder().setVisibility("private").build());
 
@@ -114,8 +114,8 @@ public class SearchActionTest {
   public void search_public_projects() {
     userSession.addPermission(ADMINISTER, db.getDefaultOrganization());
     db.components().insertComponents(
-      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("private-key"),
-      ComponentTesting.newPublicProjectDto(db.getDefaultOrganization()).setKey("public-key"));
+      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("private-key"),
+      ComponentTesting.newPublicProjectDto(db.getDefaultOrganization()).setDbKey("public-key"));
 
     SearchWsResponse response = call(SearchWsRequest.builder().setVisibility("public").build());
 
@@ -126,7 +126,7 @@ public class SearchActionTest {
   public void search_projects_when_no_qualifier_set() throws IOException {
     userSession.addPermission(ADMINISTER, db.getDefaultOrganization());
     db.components().insertComponents(
-      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey(PROJECT_KEY_1),
+      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey(PROJECT_KEY_1),
       newView(db.getDefaultOrganization()));
 
     SearchWsResponse response = call(SearchWsRequest.builder().build());
@@ -137,13 +137,13 @@ public class SearchActionTest {
   @Test
   public void search_projects() throws IOException {
     userSession.addPermission(ADMINISTER, db.getDefaultOrganization());
-    ComponentDto project = ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey(PROJECT_KEY_1);
+    ComponentDto project = ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey(PROJECT_KEY_1);
     ComponentDto module = newModuleDto(project);
     ComponentDto directory = newDirectory(module, "dir");
     ComponentDto file = newFileDto(directory);
     db.components().insertComponents(
       project, module, directory, file,
-      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey(PROJECT_KEY_2),
+      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey(PROJECT_KEY_2),
       newView(db.getDefaultOrganization()));
 
     SearchWsResponse response = call(SearchWsRequest.builder().setQualifiers(singletonList("TRK")).build());
@@ -155,8 +155,8 @@ public class SearchActionTest {
   public void search_views() throws IOException {
     userSession.addPermission(ADMINISTER, db.getDefaultOrganization());
     db.components().insertComponents(
-      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey(PROJECT_KEY_1),
-      newView(db.getDefaultOrganization()).setKey("view1"));
+      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey(PROJECT_KEY_1),
+      newView(db.getDefaultOrganization()).setDbKey("view1"));
 
     SearchWsResponse response = call(SearchWsRequest.builder().setQualifiers(singletonList("VW")).build());
 
@@ -167,8 +167,8 @@ public class SearchActionTest {
   public void search_projects_and_views() throws IOException {
     userSession.addPermission(ADMINISTER, db.getDefaultOrganization());
     db.components().insertComponents(
-      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey(PROJECT_KEY_1),
-      newView(db.getDefaultOrganization()).setKey("view1"));
+      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey(PROJECT_KEY_1),
+      newView(db.getDefaultOrganization()).setDbKey("view1"));
 
     SearchWsResponse response = call(SearchWsRequest.builder().setQualifiers(asList("TRK", "VW")).build());
 
@@ -180,9 +180,9 @@ public class SearchActionTest {
     userSession.addPermission(ADMINISTER, db.getDefaultOrganization());
     OrganizationDto otherOrganization = db.organizations().insert();
     db.components().insertComponents(
-      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey(PROJECT_KEY_1),
-      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey(PROJECT_KEY_2),
-      ComponentTesting.newPrivateProjectDto(otherOrganization).setKey(PROJECT_KEY_3));
+      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey(PROJECT_KEY_1),
+      ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey(PROJECT_KEY_2),
+      ComponentTesting.newPrivateProjectDto(otherOrganization).setDbKey(PROJECT_KEY_3));
 
     SearchWsResponse response = call(SearchWsRequest.builder().build());
 
@@ -201,7 +201,7 @@ public class SearchActionTest {
 
     SearchWsResponse response = call(SearchWsRequest.builder().setOrganization(organization1.getKey()).build());
 
-    assertThat(response.getComponentsList()).extracting(Component::getKey).containsOnly(project1.key(), project2.key());
+    assertThat(response.getComponentsList()).extracting(Component::getKey).containsOnly(project1.getDbKey(), project2.getDbKey());
   }
 
   @Test
@@ -209,7 +209,7 @@ public class SearchActionTest {
     userSession.addPermission(ADMINISTER, db.getDefaultOrganization());
     List<ComponentDto> componentDtoList = new ArrayList<>();
     for (int i = 1; i <= 9; i++) {
-      componentDtoList.add(newPrivateProjectDto(db.getDefaultOrganization(), "project-uuid-" + i).setKey("project-key-" + i).setName("Project Name " + i));
+      componentDtoList.add(newPrivateProjectDto(db.getDefaultOrganization(), "project-uuid-" + i).setDbKey("project-key-" + i).setName("Project Name " + i));
     }
     db.components().insertComponents(componentDtoList.toArray(new ComponentDto[] {}));
 
@@ -291,8 +291,8 @@ public class SearchActionTest {
     OrganizationDto organization = db.organizations().insertForKey("my-org-1");
     userSession.addPermission(ADMINISTER, organization);
     db.components().insertComponents(
-      newPrivateProjectDto(organization, "project-uuid-1").setName("Project Name 1").setKey("project-key-1").setPrivate(false),
-      newPrivateProjectDto(organization, "project-uuid-2").setName("Project Name 1").setKey("project-key-2"));
+      newPrivateProjectDto(organization, "project-uuid-1").setName("Project Name 1").setDbKey("project-key-1").setPrivate(false),
+      newPrivateProjectDto(organization, "project-uuid-2").setName("Project Name 1").setDbKey("project-key-2"));
 
     String response = ws.newRequest()
       .setMediaType(MediaTypes.JSON)
index 2cb6c74d0e57c5c81563d34b674ff94eef5fb8bd..41317815d340ce26482b65638e457f52803d78b6 100644 (file)
@@ -244,20 +244,20 @@ public class SearchMyProjectsActionTest {
   private ComponentDto insertClang(OrganizationDto organizationDto) {
     return db.components().insertComponent(newPrivateProjectDto(organizationDto, Uuids.UUID_EXAMPLE_01)
       .setName("Clang")
-      .setKey("clang"));
+      .setDbKey("clang"));
   }
 
   private ComponentDto insertJdk7(OrganizationDto organizationDto) {
     return db.components().insertComponent(newPrivateProjectDto(organizationDto, Uuids.UUID_EXAMPLE_02)
       .setName("JDK 7")
-      .setKey("net.java.openjdk:jdk7")
+      .setDbKey("net.java.openjdk:jdk7")
       .setDescription("JDK"));
   }
 
   private ComponentDto insertView(OrganizationDto organizationDto) {
     return db.components().insertComponent(newView(organizationDto, "752d8bfd-420c-4a83-a4e5-8ab19b13c8fc")
       .setName("Java")
-      .setKey("Java"));
+      .setDbKey("Java"));
   }
 
   private SearchMyProjectsWsResponse call_ws() {
index 0aebe3ab86af88e8f4677f898a9efb35f58412d8..cf0536445cb2bc22ec62042a2f1cbc13dbbce769 100644 (file)
@@ -67,7 +67,7 @@ public class UpdateKeyActionTest {
   public void call_by_key() {
     ComponentDto project = insertProject();
 
-    callByKey(project.key(), ANOTHER_KEY);
+    callByKey(project.getDbKey(), ANOTHER_KEY);
 
     assertCallComponentService(ANOTHER_KEY);
   }
@@ -87,7 +87,7 @@ public class UpdateKeyActionTest {
 
     ComponentDto project = insertProject();
 
-    callByKey(project.key(), null);
+    callByKey(project.getDbKey(), null);
   }
 
   @Test
@@ -103,7 +103,7 @@ public class UpdateKeyActionTest {
 
     ComponentDto project = insertProject();
 
-    call(project.uuid(), project.key(), ANOTHER_KEY);
+    call(project.uuid(), project.getDbKey(), ANOTHER_KEY);
   }
 
   @Test
index dd6dd8d9fba39092d016bd014456ec8088de0c95..3621957098bce9c850835c79e4bf204ef3cdfbfa 100644 (file)
@@ -190,7 +190,7 @@ public class UpdateVisibilityActionTest {
 
     Stream.of(module, dir, file, view, subView, projectCopy)
       .forEach(nonRootComponent -> {
-        request.setParam(PARAM_PROJECT, nonRootComponent.key())
+        request.setParam(PARAM_PROJECT, nonRootComponent.getDbKey())
           .setParam(PARAM_VISIBILITY, randomVisibility);
 
         try {
@@ -206,7 +206,7 @@ public class UpdateVisibilityActionTest {
   public void execute_throws_ForbiddenException_if_user_has_no_permission_on_specified_component() {
     OrganizationDto organization = dbTester.organizations().insert();
     ComponentDto project = dbTester.components().insertPrivateProject(organization);
-    request.setParam(PARAM_PROJECT, project.key())
+    request.setParam(PARAM_PROJECT, project.getDbKey())
       .setParam(PARAM_VISIBILITY, randomVisibility);
 
     expectInsufficientPrivilegeException();
@@ -218,12 +218,12 @@ public class UpdateVisibilityActionTest {
   public void execute_throws_ForbiddenException_if_user_has_all_permissions_but_ADMIN_on_specified_component() {
     OrganizationDto organization = dbTester.organizations().insert();
     ComponentDto project = dbTester.components().insertPublicProject(organization);
-    request.setParam(PARAM_PROJECT, project.key())
+    request.setParam(PARAM_PROJECT, project.getDbKey())
       .setParam(PARAM_VISIBILITY, randomVisibility);
     userSessionRule.addProjectPermission(UserRole.ISSUE_ADMIN, project);
     Arrays.stream(OrganizationPermission.values())
       .forEach(perm -> userSessionRule.addPermission(perm, organization));
-    request.setParam(PARAM_PROJECT, project.key())
+    request.setParam(PARAM_PROJECT, project.getDbKey())
       .setParam(PARAM_VISIBILITY, randomVisibility);
 
     expectInsufficientPrivilegeException();
@@ -236,7 +236,7 @@ public class UpdateVisibilityActionTest {
     ComponentDto project = randomPublicOrPrivateProject();
     IntStream.range(0, 1 + Math.abs(random.nextInt(5)))
       .forEach(i -> insertPendingTask(project));
-    request.setParam(PARAM_PROJECT, project.key())
+    request.setParam(PARAM_PROJECT, project.getDbKey())
       .setParam(PARAM_VISIBILITY, randomVisibility);
     userSessionRule.addProjectPermission(UserRole.ADMIN, project);
 
@@ -251,7 +251,7 @@ public class UpdateVisibilityActionTest {
     ComponentDto project = randomPublicOrPrivateProject();
     IntStream.range(0, 1 + Math.abs(random.nextInt(5)))
       .forEach(i -> insertInProgressTask(project));
-    request.setParam(PARAM_PROJECT, project.key())
+    request.setParam(PARAM_PROJECT, project.getDbKey())
       .setParam(PARAM_VISIBILITY, randomVisibility);
     userSessionRule.addProjectPermission(UserRole.ADMIN, project);
 
@@ -269,9 +269,9 @@ public class UpdateVisibilityActionTest {
     userSessionRule.addProjectPermission(UserRole.ADMIN, project);
 
     expectedException.expect(IllegalStateException.class);
-    expectedException.expectMessage(format("Could not find organization with uuid '%s' of project '%s'", organization.getUuid(), project.key()));
+    expectedException.expectMessage(format("Could not find organization with uuid '%s' of project '%s'", organization.getUuid(), project.getDbKey()));
 
-    request.setParam(PARAM_PROJECT, project.key())
+    request.setParam(PARAM_PROJECT, project.getDbKey())
       .setParam(PARAM_VISIBILITY, PRIVATE)
       .execute();
   }
@@ -286,7 +286,7 @@ public class UpdateVisibilityActionTest {
     dbTester.components().insertComponents(module, dir, file);
     userSessionRule.addProjectPermission(UserRole.ADMIN, project);
 
-    request.setParam(PARAM_PROJECT, project.key())
+    request.setParam(PARAM_PROJECT, project.getDbKey())
       .setParam(PARAM_VISIBILITY, initiallyPrivate ? PUBLIC : PRIVATE)
       .execute();
 
@@ -310,7 +310,7 @@ public class UpdateVisibilityActionTest {
     dbTester.components().insertComponents(module, dir, file);
     userSessionRule.addProjectPermission(UserRole.ADMIN, project);
 
-    request.setParam(PARAM_PROJECT, project.key())
+    request.setParam(PARAM_PROJECT, project.getDbKey())
       .setParam(PARAM_VISIBILITY, initiallyPrivate ? PRIVATE : PUBLIC)
       .execute();
 
@@ -329,7 +329,7 @@ public class UpdateVisibilityActionTest {
     unsafeGiveAllPermissionsToRootComponent(project, user, group, organization);
     userSessionRule.addProjectPermission(UserRole.ADMIN, project);
 
-    request.setParam(PARAM_PROJECT, project.key())
+    request.setParam(PARAM_PROJECT, project.getDbKey())
       .setParam(PARAM_VISIBILITY, PRIVATE)
       .execute();
 
@@ -345,7 +345,7 @@ public class UpdateVisibilityActionTest {
     unsafeGiveAllPermissionsToRootComponent(project, user, group, organization);
     userSessionRule.addProjectPermission(UserRole.ADMIN, project);
 
-    request.setParam(PARAM_PROJECT, project.key())
+    request.setParam(PARAM_PROJECT, project.getDbKey())
       .setParam(PARAM_VISIBILITY, PRIVATE)
       .execute();
 
@@ -361,7 +361,7 @@ public class UpdateVisibilityActionTest {
     unsafeGiveAllPermissionsToRootComponent(project, user, group, organization);
     userSessionRule.addProjectPermission(UserRole.ADMIN, project);
 
-    request.setParam(PARAM_PROJECT, project.key())
+    request.setParam(PARAM_PROJECT, project.getDbKey())
       .setParam(PARAM_VISIBILITY, PUBLIC)
       .execute();
 
@@ -377,7 +377,7 @@ public class UpdateVisibilityActionTest {
     unsafeGiveAllPermissionsToRootComponent(project, user, group, organization);
     userSessionRule.addProjectPermission(UserRole.ADMIN, project);
 
-    request.setParam(PARAM_PROJECT, project.key())
+    request.setParam(PARAM_PROJECT, project.getDbKey())
       .setParam(PARAM_VISIBILITY, PUBLIC)
       .execute();
 
@@ -390,7 +390,7 @@ public class UpdateVisibilityActionTest {
     boolean initiallyPrivate = project.isPrivate();
     userSessionRule.addProjectPermission(UserRole.ADMIN, project);
 
-    request.setParam(PARAM_PROJECT, project.key())
+    request.setParam(PARAM_PROJECT, project.getDbKey())
       .setParam(PARAM_VISIBILITY, initiallyPrivate ? PUBLIC : PRIVATE)
       .execute();
 
@@ -403,7 +403,7 @@ public class UpdateVisibilityActionTest {
     boolean initiallyPrivate = project.isPrivate();
     userSessionRule.addProjectPermission(UserRole.ADMIN, project);
 
-    request.setParam(PARAM_PROJECT, project.key())
+    request.setParam(PARAM_PROJECT, project.getDbKey())
       .setParam(PARAM_VISIBILITY, initiallyPrivate ? PRIVATE : PUBLIC)
       .execute();
 
@@ -422,7 +422,7 @@ public class UpdateVisibilityActionTest {
     dbTester.users().insertProjectPermissionOnUser(user2, "p2", project);
     userSessionRule.addProjectPermission(UserRole.ADMIN, project);
 
-    request.setParam(PARAM_PROJECT, project.key())
+    request.setParam(PARAM_PROJECT, project.getDbKey())
       .setParam(PARAM_VISIBILITY, PRIVATE)
       .execute();
 
@@ -446,7 +446,7 @@ public class UpdateVisibilityActionTest {
     dbTester.users().insertProjectPermissionOnGroup(group2, "p2", project);
     userSessionRule.addProjectPermission(UserRole.ADMIN, project);
 
-    request.setParam(PARAM_PROJECT, project.key())
+    request.setParam(PARAM_PROJECT, project.getDbKey())
       .setParam(PARAM_VISIBILITY, PRIVATE)
       .execute();
 
@@ -470,7 +470,7 @@ public class UpdateVisibilityActionTest {
     expectedException.expect(IllegalArgumentException.class);
     expectedException.expectMessage("This organization cannot use project private");
 
-    request.setParam(PARAM_PROJECT, project.key())
+    request.setParam(PARAM_PROJECT, project.getDbKey())
       .setParam(PARAM_VISIBILITY, PRIVATE)
       .execute();
   }
@@ -484,7 +484,7 @@ public class UpdateVisibilityActionTest {
     doThrow(new BillingValidations.BillingValidationsException("This organization cannot use project private")).when(billingValidations)
       .checkCanUpdateProjectVisibility(any(BillingValidations.Organization.class), eq(true));
 
-    request.setParam(PARAM_PROJECT, project.key())
+    request.setParam(PARAM_PROJECT, project.getDbKey())
       .setParam(PARAM_VISIBILITY, PUBLIC)
       .execute();
   }
index 9765c2f6b183f4e3dad324bc59ce97d7910113e7..24bf9f732a70ec00489882ed6d4e208e9fe2819c 100644 (file)
@@ -85,7 +85,7 @@ public class SearchActionTest {
   @Test
   public void json_example() {
     OrganizationDto organizationDto = db.organizations().insert();
-    ComponentDto project = db.components().insertComponent(ComponentTesting.newPrivateProjectDto(organizationDto).setKey(KEY_PROJECT_EXAMPLE_001));
+    ComponentDto project = db.components().insertComponent(ComponentTesting.newPrivateProjectDto(organizationDto).setDbKey(KEY_PROJECT_EXAMPLE_001));
     userSession.addProjectPermission(UserRole.USER, project);
     SnapshotDto a1 = db.components().insertSnapshot(newAnalysis(project).setUuid("A1").setCreatedAt(parseDateTime("2016-12-11T17:12:45+0100").getTime()));
     SnapshotDto a2 = db.components().insertSnapshot(newAnalysis(project).setUuid("A2").setCreatedAt(parseDateTime("2016-12-12T17:12:45+0100").getTime()));
@@ -110,7 +110,7 @@ public class SearchActionTest {
 
   @Test
   public void return_analyses_ordered_by_analysis_date() {
-    ComponentDto project = db.components().insertComponent(ComponentTesting.newPrivateProjectDto(db.organizations().insert()).setKey("P1"));
+    ComponentDto project = db.components().insertComponent(ComponentTesting.newPrivateProjectDto(db.organizations().insert()).setDbKey("P1"));
     userSession.addProjectPermission(UserRole.USER, project);
     db.components().insertSnapshot(newAnalysis(project).setUuid("A1").setCreatedAt(1_000_000L));
     db.components().insertSnapshot(newAnalysis(project).setUuid("A2").setCreatedAt(2_000_000L));
@@ -127,7 +127,7 @@ public class SearchActionTest {
 
   @Test
   public void return_only_processed_analyses() {
-    ComponentDto project = db.components().insertComponent(ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setKey("P1"));
+    ComponentDto project = db.components().insertComponent(ComponentTesting.newPrivateProjectDto(db.getDefaultOrganization()).setDbKey("P1"));
     userSession.addProjectPermission(UserRole.USER, project);
     db.components().insertSnapshot(newAnalysis(project).setUuid("A1"));
     db.components().insertSnapshot(newAnalysis(project).setUuid("A2").setStatus(SnapshotDto.STATUS_UNPROCESSED));
@@ -141,7 +141,7 @@ public class SearchActionTest {
   @Test
   public void return_events() {
     OrganizationDto organizationDto = db.organizations().insert();
-    ComponentDto project = db.components().insertComponent(ComponentTesting.newPrivateProjectDto(organizationDto).setKey("P1"));
+    ComponentDto project = db.components().insertComponent(ComponentTesting.newPrivateProjectDto(organizationDto).setDbKey("P1"));
     userSession.addProjectPermission(UserRole.USER, project);
     SnapshotDto a1 = db.components().insertSnapshot(newAnalysis(project).setUuid("A1"));
     SnapshotDto a42 = db.components().insertSnapshot(newAnalysis(ComponentTesting.newPrivateProjectDto(organizationDto)).setUuid("A42"));
@@ -168,7 +168,7 @@ public class SearchActionTest {
     SnapshotDto secondAnalysis = db.components().insertSnapshot(newAnalysis(application).setCreatedAt(2_000_000L));
     SnapshotDto thirdAnalysis = db.components().insertSnapshot(newAnalysis(application).setCreatedAt(3_000_000L));
 
-    List<Analysis> result = call(application.key()).getAnalysesList();
+    List<Analysis> result = call(application.getDbKey()).getAnalysesList();
 
     assertThat(result).hasSize(3);
     assertThat(result).extracting(Analysis::getKey).containsExactly(thirdAnalysis.getUuid(), secondAnalysis.getUuid(), firstAnalysis.getUuid());
@@ -181,7 +181,7 @@ public class SearchActionTest {
     IntStream.rangeClosed(1, 9).forEach(i -> db.components().insertSnapshot(newAnalysis(project).setCreatedAt(1_000_000L * i).setUuid("A" + i)));
 
     SearchResponse result = call(SearchRequest.builder()
-      .setProject(project.key())
+      .setProject(project.getDbKey())
       .setPage(2)
       .setPageSize(3)
       .build());
@@ -192,7 +192,7 @@ public class SearchActionTest {
 
   @Test
   public void filter_by_category() {
-    ComponentDto project = db.components().insertComponent(ComponentTesting.newPrivateProjectDto(db.organizations().insert()).setKey("P1"));
+    ComponentDto project = db.components().insertComponent(ComponentTesting.newPrivateProjectDto(db.organizations().insert()).setDbKey("P1"));
     userSession.addProjectPermission(UserRole.USER, project);
     SnapshotDto a1 = db.components().insertSnapshot(newAnalysis(project).setUuid("A1"));
     SnapshotDto a2 = db.components().insertSnapshot(newAnalysis(project).setUuid("A2"));
@@ -213,7 +213,7 @@ public class SearchActionTest {
 
   @Test
   public void paginate_with_filter_on_category() {
-    ComponentDto project = db.components().insertComponent(ComponentTesting.newPrivateProjectDto(db.organizations().insert()).setKey("P1"));
+    ComponentDto project = db.components().insertComponent(ComponentTesting.newPrivateProjectDto(db.organizations().insert()).setDbKey("P1"));
     userSession.addProjectPermission(UserRole.USER, project);
     SnapshotDto a1 = db.components().insertSnapshot(newAnalysis(project).setUuid("A1").setCreatedAt(1_000_000L));
     SnapshotDto a2 = db.components().insertSnapshot(newAnalysis(project).setUuid("A2").setCreatedAt(2_000_000L));
@@ -248,7 +248,7 @@ public class SearchActionTest {
     SnapshotDto a4 = db.components().insertSnapshot(newAnalysis(project).setUuid("a4").setCreatedAt(4_000_000_000L));
 
     SearchResponse result = call(SearchRequest.builder()
-      .setProject(project.key())
+      .setProject(project.getDbKey())
       .setFrom(formatDateTime(2_000_000_000L))
       .build());
 
@@ -268,7 +268,7 @@ public class SearchActionTest {
     SnapshotDto a4 = db.components().insertSnapshot(newAnalysis(project).setUuid("a4").setCreatedAt(4_000_000_000L));
 
     SearchResponse result = call(SearchRequest.builder()
-      .setProject(project.key())
+      .setProject(project.getDbKey())
       .setTo(formatDateTime(2_000_000_000L))
       .build());
 
@@ -288,7 +288,7 @@ public class SearchActionTest {
     SnapshotDto a4 = db.components().insertSnapshot(newAnalysis(project).setUuid("a4").setCreatedAt(4_000_000_000L));
 
     SearchResponse result = call(SearchRequest.builder()
-      .setProject(project.key())
+      .setProject(project.getDbKey())
       .setFrom(formatDateTime(2_000_000_000L))
       .setTo(formatDateTime(3_000_000_000L))
       .build());
@@ -309,7 +309,7 @@ public class SearchActionTest {
     SnapshotDto a4 = db.components().insertSnapshot(newAnalysis(project).setUuid("a4").setCreatedAt(4_000_000_000L));
 
     SearchResponse result = call(SearchRequest.builder()
-      .setProject(project.key())
+      .setProject(project.getDbKey())
       .setFrom(formatDate(new Date(2_000_000_000L)))
       .setTo(formatDate(new Date(3_000_000_000L)))
       .build());
@@ -325,7 +325,7 @@ public class SearchActionTest {
     ComponentDto project = db.components().insertPrivateProject();
     userSession.addProjectPermission(UserRole.USER, project);
 
-    SearchResponse result = call(project.key());
+    SearchResponse result = call(project.getDbKey());
 
     assertThat(result.hasPaging()).isTrue();
     assertThat(result.getPaging()).extracting(Paging::getPageIndex, Paging::getPageSize, Paging::getTotal).containsExactly(1, 100, 0);
@@ -356,7 +356,7 @@ public class SearchActionTest {
 
     expectedException.expect(ForbiddenException.class);
 
-    call(project.key());
+    call(project.getDbKey());
   }
 
   @Test
@@ -375,7 +375,7 @@ public class SearchActionTest {
     expectedException.expect(IllegalArgumentException.class);
     expectedException.expectMessage("A project or application is required");
 
-    call(view.key());
+    call(view.getDbKey());
   }
 
   private static Function<Event, String> wsToDbCategory() {
index 25475e9115b499a4e731726880daa9d1249c7d2b..6ae5c751c5519eb67548d89158c8137645e8701b 100644 (file)
@@ -87,7 +87,7 @@ public class CreateActionTest {
 
     String result = ws.newRequest()
       .setMethod("POST")
-      .setParam(PARAM_PROJECT_KEY, project.key())
+      .setParam(PARAM_PROJECT_KEY, project.getDbKey())
       .setParam(PARAM_NAME, "Custom")
       .setParam(PARAM_URL, "http://example.org")
       .execute().getInput();
@@ -234,11 +234,11 @@ public class CreateActionTest {
     userSession.logIn().addProjectPermission(UserRole.ADMIN, root);
 
     expectedException.expect(BadRequestException.class);
-    expectedException.expectMessage("Component '" + component.key() + "' (id: " + component.uuid() + ") must be a project");
+    expectedException.expectMessage("Component '" + component.getDbKey() + "' (id: " + component.uuid() + ") must be a project");
 
     TestRequest testRequest = ws.newRequest();
     if (new Random().nextBoolean()) {
-      testRequest.setParam(PARAM_PROJECT_KEY, component.key());
+      testRequest.setParam(PARAM_PROJECT_KEY, component.getDbKey());
     } else {
       testRequest.setParam(PARAM_PROJECT_ID, component.uuid());
     }
@@ -251,13 +251,13 @@ public class CreateActionTest {
   private ComponentDto insertProject() {
     OrganizationDto org = db.organizations().insert();
     return db.components().insertComponent(
-      ComponentTesting.newPrivateProjectDto(org, PROJECT_UUID).setKey(PROJECT_KEY));
+      ComponentTesting.newPrivateProjectDto(org, PROJECT_UUID).setDbKey(PROJECT_KEY));
   }
 
   private void createAndTest(ComponentDto project, String name, String url, String type) throws IOException {
     WsProjectLinks.CreateWsResponse response = ws.newRequest()
       .setMethod("POST")
-      .setParam(PARAM_PROJECT_KEY, project.key())
+      .setParam(PARAM_PROJECT_KEY, project.getDbKey())
       .setParam(PARAM_NAME, name)
       .setParam(PARAM_URL, url)
       .executeProtobuf(WsProjectLinks.CreateWsResponse.class);
index ad81d1daea9da860a2607f6e9ef04a5449e2c8a7..81bcd42594d263431af4b30ca27e7055c2eb9677 100644 (file)
@@ -152,7 +152,7 @@ public class DeleteActionTest {
     return componentDb.insertComponent(new ComponentDto()
       .setOrganizationUuid("org1")
       .setUuid(projectUuid)
-      .setKey(projectKey)
+      .setDbKey(projectKey)
       .setUuidPath("")
       .setRootUuid("")
       .setProjectUuid(""));
index b341f50b8a4a55613b58675aedcf0452f033d3bc..b8e2eca57eb85915c1f9b7549d413715cca97196 100644 (file)
@@ -112,7 +112,7 @@ public class SearchActionTest {
     insertHomepageLink(project.uuid());
     logInAsProjectAdministrator(project);
 
-    SearchWsResponse response = callByKey(project.key());
+    SearchWsResponse response = callByKey(project.getDbKey());
 
     assertThat(response.getLinksCount()).isEqualTo(1);
     assertThat(response.getLinks(0).getName()).isEqualTo("Homepage");
@@ -125,7 +125,7 @@ public class SearchActionTest {
     ComponentLinkDto customLink = insertCustomLink(project.uuid());
     logInAsProjectAdministrator(project);
 
-    SearchWsResponse response = callByKey(project.key());
+    SearchWsResponse response = callByKey(project.getDbKey());
 
     assertThat(response.getLinksCount()).isEqualTo(2);
     assertThat(response.getLinksList()).extracting(Link::getId, Link::getName, Link::getType, Link::getUrl)
@@ -142,7 +142,7 @@ public class SearchActionTest {
     insertCustomLink(project2.uuid());
     userSession.logIn().setRoot();
 
-    SearchWsResponse response = callByKey(project1.key());
+    SearchWsResponse response = callByKey(project1.getDbKey());
 
     assertThat(response.getLinksCount()).isEqualTo(1);
     assertThat(response.getLinks(0).getId()).isEqualTo(customLink1.getIdAsString());
@@ -155,7 +155,7 @@ public class SearchActionTest {
     insertLink(foo);
     logInAsProjectAdministrator(project);
 
-    callByKey(project.key());
+    callByKey(project.getDbKey());
   }
 
   @Test
@@ -165,7 +165,7 @@ public class SearchActionTest {
     insertLink(foo);
     logInAsProjectAdministrator(project);
 
-    callByKey(project.key());
+    callByKey(project.getDbKey());
   }
 
   @Test
@@ -222,11 +222,11 @@ public class SearchActionTest {
     userSession.logIn().addProjectPermission(UserRole.ADMIN, root);
 
     expectedException.expect(BadRequestException.class);
-    expectedException.expectMessage("Component '" + component.key() + "' (id: " + component.uuid() + ") must be a project");
+    expectedException.expectMessage("Component '" + component.getDbKey() + "' (id: " + component.uuid() + ") must be a project");
 
     TestRequest testRequest = ws.newRequest();
     if (new Random().nextBoolean()) {
-      testRequest.setParam(PARAM_PROJECT_KEY, component.key());
+      testRequest.setParam(PARAM_PROJECT_KEY, component.getDbKey());
     } else {
       testRequest.setParam(PARAM_PROJECT_ID, component.uuid());
     }
@@ -249,7 +249,7 @@ public class SearchActionTest {
 
     expectedException.expect(IllegalArgumentException.class);
     ws.newRequest()
-      .setParam(PARAM_PROJECT_KEY, project.key())
+      .setParam(PARAM_PROJECT_KEY, project.getDbKey())
       .setParam(PARAM_PROJECT_ID, project.uuid())
       .execute();
   }
@@ -266,7 +266,7 @@ public class SearchActionTest {
   }
 
   private ComponentDto insertProject(String projectKey, String projectUuid) {
-    return componentDb.insertComponent(newPrivateProjectDto(db.organizations().insert(), projectUuid).setKey(projectKey));
+    return componentDb.insertComponent(newPrivateProjectDto(db.organizations().insert(), projectUuid).setDbKey(projectKey));
   }
 
   private ComponentDto insertProject() {
@@ -312,7 +312,7 @@ public class SearchActionTest {
 
   private void checkItWorks(ComponentDto project) throws IOException {
     insertHomepageLink(project.uuid());
-    SearchWsResponse response = callByKey(project.key());
+    SearchWsResponse response = callByKey(project.getDbKey());
     assertThat(response.getLinksCount()).isEqualTo(1);
     assertThat(response.getLinks(0).getName()).isEqualTo("Homepage");
   }
index e5b5bf0fe80fa57ed44e4b23d0ff5b012ca1d153..ecefab80741fd7b6f86c78f3637f3f83b2e4f20e 100644 (file)
@@ -123,7 +123,7 @@ public class SearchActionTest {
     return new ProjectMeasuresDoc()
       .setOrganizationUuid(project.getOrganizationUuid())
       .setId(project.uuid())
-      .setKey(project.key())
+      .setKey(project.getDbKey())
       .setName(project.name());
   }
 
index 7c35d20840c5e02dd0b08c6a335e8e1811a9a16f..642f18fda233e50fb48007292aa63aa67457c2f1 100644 (file)
@@ -69,9 +69,9 @@ public class SetActionTest {
 
   @Test
   public void set_tags_exclude_empty_and_blank_values() {
-    TestResponse response = call(project.key(), "finance , offshore, platform,   ,");
+    TestResponse response = call(project.getDbKey(), "finance , offshore, platform,   ,");
 
-    assertTags(project.key(), "finance", "offshore", "platform");
+    assertTags(project.getDbKey(), "finance", "offshore", "platform");
     // FIXME verify(indexer).indexProject(project.uuid(), PROJECT_TAGS_UPDATE);
 
     assertThat(response.getStatus()).isEqualTo(HTTP_NO_CONTENT);
@@ -81,34 +81,34 @@ public class SetActionTest {
   public void reset_tags() {
     project = db.components().insertPrivateProject(p -> p.setTagsString("platform,scanner"));
 
-    call(project.key(), "");
+    call(project.getDbKey(), "");
 
-    assertNoTags(project.key());
+    assertNoTags(project.getDbKey());
   }
 
   @Test
   public void override_existing_tags() {
     project = db.components().insertPrivateProject(p -> p.setTagsString("marketing,languages"));
 
-    call(project.key(), "finance,offshore,platform");
+    call(project.getDbKey(), "finance,offshore,platform");
 
-    assertTags(project.key(), "finance", "offshore", "platform");
+    assertTags(project.getDbKey(), "finance", "offshore", "platform");
   }
 
   @Test
   public void set_tags_as_project_admin() {
     userSession.logIn().addProjectPermission(UserRole.ADMIN, project);
 
-    call(project.key(), "platform, lambda");
+    call(project.getDbKey(), "platform, lambda");
 
-    assertTags(project.key(), "platform", "lambda");
+    assertTags(project.getDbKey(), "platform", "lambda");
   }
 
   @Test
   public void do_not_duplicate_tags() {
-    call(project.key(), "atlas, atlas, atlas");
+    call(project.getDbKey(), "atlas, atlas, atlas");
 
-    assertTags(project.key(), "atlas");
+    assertTags(project.getDbKey(), "atlas");
   }
 
   @Test
@@ -116,7 +116,7 @@ public class SetActionTest {
     expectedException.expect(BadRequestException.class);
     expectedException.expectMessage("_finance_' is invalid. Project tags accept only the characters: a-z, 0-9, '+', '-', '#', '.'");
 
-    call(project.key(), "_finance_");
+    call(project.getDbKey(), "_finance_");
   }
 
   @Test
@@ -125,7 +125,7 @@ public class SetActionTest {
 
     expectedException.expect(ForbiddenException.class);
 
-    call(project.key(), "platform");
+    call(project.getDbKey(), "platform");
   }
 
   @Test
@@ -139,37 +139,37 @@ public class SetActionTest {
   public void fail_if_no_tags() {
     expectedException.expect(IllegalArgumentException.class);
 
-    call(project.key(), null);
+    call(project.getDbKey(), null);
   }
 
   @Test
   public void fail_if_component_is_a_view() {
-    ComponentDto view = db.components().insertView(v -> v.setKey("VIEW_KEY"));
+    ComponentDto view = db.components().insertView(v -> v.setDbKey("VIEW_KEY"));
 
     expectedException.expect(BadRequestException.class);
     expectedException.expectMessage("Component 'VIEW_KEY' is not a project");
 
-    call(view.key(), "point-of-view");
+    call(view.getDbKey(), "point-of-view");
   }
 
   @Test
   public void fail_if_component_is_a_module() {
-    ComponentDto module = db.components().insertComponent(newModuleDto(project).setKey("MODULE_KEY"));
+    ComponentDto module = db.components().insertComponent(newModuleDto(project).setDbKey("MODULE_KEY"));
 
     expectedException.expect(BadRequestException.class);
     expectedException.expectMessage("Component 'MODULE_KEY' is not a project");
 
-    call(module.key(), "modz");
+    call(module.getDbKey(), "modz");
   }
 
   @Test
   public void fail_if_component_is_a_file() {
-    ComponentDto file = db.components().insertComponent(newFileDto(project).setKey("FILE_KEY"));
+    ComponentDto file = db.components().insertComponent(newFileDto(project).setDbKey("FILE_KEY"));
 
     expectedException.expect(BadRequestException.class);
     expectedException.expectMessage("Component 'FILE_KEY' is not a project");
 
-    call(file.getKey(), "secret");
+    call(file.getDbKey(), "secret");
   }
 
   @Test
index 1c6c5e1e127c1bd4ff26f7c18c41a9f03e7ca004..f0cffa4c67039afe6a2c97d7e9b4c497b5730c5d 100644 (file)
@@ -157,7 +157,7 @@ public class IndexActionTest {
       // The property is overriding global value
       newComponentPropertyDto(project).setKey("property").setValue("two"));
 
-    executeAndVerify(project.key(), null, "return_project_values.json");
+    executeAndVerify(project.getDbKey(), null, "return_project_values.json");
   }
 
   @Test
@@ -205,7 +205,7 @@ public class IndexActionTest {
       // The property is overriding global value
       newComponentPropertyDto(module).setKey("property").setValue("two"));
 
-    executeAndVerify(module.key(), "property", "return_module_values.json");
+    executeAndVerify(module.getDbKey(), "property", "return_module_values.json");
   }
 
   @Test
@@ -222,7 +222,7 @@ public class IndexActionTest {
       newComponentPropertyDto(project).setKey("projectProperty").setValue("project"),
       newComponentPropertyDto(module).setKey("moduleProperty").setValue("module"));
 
-    executeAndVerify(module.key(), null, "return_inherited_values_on_module.json");
+    executeAndVerify(module.getDbKey(), null, "return_inherited_values_on_module.json");
   }
 
   @Test
@@ -323,7 +323,7 @@ public class IndexActionTest {
       newComponentPropertyDto(project).setKey("plugin.license.secured").setValue("ABCD"),
       newComponentPropertyDto(project).setKey("plugin.licenseHash.secured").setValue("987654321"));
 
-    executeAndVerify(project.key(), null, "return_secured_and_license_settings_when_project_admin.json");
+    executeAndVerify(project.getDbKey(), null, "return_secured_and_license_settings_when_project_admin.json");
   }
 
   @Test
@@ -373,7 +373,7 @@ public class IndexActionTest {
       newComponentPropertyDto(project).setKey("not_defined").setValue("ABCD"),
       newGlobalPropertyDto().setKey("global_not_defined").setValue("ABCD"));
 
-    executeAndVerify(project.key(), null, "return_all_project_settings_when_component_and_no_key.json");
+    executeAndVerify(project.getDbKey(), null, "return_all_project_settings_when_component_and_no_key.json");
   }
 
   @Test
@@ -385,8 +385,8 @@ public class IndexActionTest {
       newGlobalPropertyDto().setKey("foo").setValue("one"),
       newGlobalPropertyDto().setKey("bar").setValue("two"));
 
-    executeAndVerify(project.key(), "foo", "return_only_one_setting_when_key_is_provided.json");
-    executeAndVerify(project.key(), "unknown", "empty.json");
+    executeAndVerify(project.getDbKey(), "foo", "return_only_one_setting_when_key_is_provided.json");
+    executeAndVerify(project.getDbKey(), "unknown", "empty.json");
   }
 
   @Test
@@ -395,7 +395,7 @@ public class IndexActionTest {
     definitions.addComponent(PropertyDefinition.builder("foo").build());
     propertyDb.insertProperties(newComponentPropertyDto(project).setKey("foo").setValue("one"));
 
-    executeAndVerify(project.key(), null, "does_not_fail_when_user_has_not_project_browse_permission.json");
+    executeAndVerify(project.getDbKey(), null, "does_not_fail_when_user_has_not_project_browse_permission.json");
   }
 
   @Test
index 38753c5f3460f16540f64a20f27d3e4bca1f2704..fca5ac6eda79cd2f34c547f3a9af469040c966f5 100644 (file)
@@ -91,7 +91,7 @@ public class QualityGatesTest {
     when(dbClient.componentDao()).thenReturn(componentDao);
 
     when(componentDao.selectOrFailById(eq(dbSession), anyLong())).thenReturn(
-      newPrivateProjectDto(OrganizationTesting.newOrganizationDto(), PROJECT_UUID).setId(1L).setKey(PROJECT_KEY));
+      newPrivateProjectDto(OrganizationTesting.newOrganizationDto(), PROJECT_UUID).setId(1L).setDbKey(PROJECT_KEY));
 
     underTest = new QualityGates(dbClient, metricFinder, userSession);
 
index 5c7e6dae89aaf9e94df883c1f5128589d9b8d906..e56b4deeeb0917e8da759d8a0647c7c46fbaf6c2 100644 (file)
@@ -106,7 +106,7 @@ public class DeselectActionTest {
     String gateId = String.valueOf(gate.getId());
     associateProjectToQualityGate(project.getId(), gateId);
 
-    callByKey(gateId, project.getKey());
+    callByKey(gateId, project.getDbKey());
 
     assertDeselected(project.getId());
   }
@@ -118,7 +118,7 @@ public class DeselectActionTest {
 
     userSession.logIn().addProjectPermission(UserRole.ADMIN, project);
 
-    callByKey(gateId, project.getKey());
+    callByKey(gateId, project.getDbKey());
 
     assertDeselected(project.getId());
   }
@@ -127,7 +127,7 @@ public class DeselectActionTest {
   public void fail_when_no_quality_gate() throws Exception {
     expectedException.expect(NotFoundException.class);
 
-    callByKey("-1", project.getKey());
+    callByKey("-1", project.getDbKey());
   }
 
   @Test
@@ -154,7 +154,7 @@ public class DeselectActionTest {
     userSession.anonymous();
 
     expectedException.expect(ForbiddenException.class);
-    callByKey(gateId, project.getKey());
+    callByKey(gateId, project.getDbKey());
   }
 
   @Test
@@ -165,7 +165,7 @@ public class DeselectActionTest {
 
     expectedException.expect(ForbiddenException.class);
 
-    callByKey(gateId, project.getKey());
+    callByKey(gateId, project.getDbKey());
   }
 
   @Test
@@ -176,7 +176,7 @@ public class DeselectActionTest {
 
     expectedException.expect(ForbiddenException.class);
 
-    callByKey(gateId, project.getKey());
+    callByKey(gateId, project.getDbKey());
   }
 
   private QualityGateDto insertQualityGate() {
index ca6494ce105589cac24026ba633fd067ad8fe77d..f11cc408962cb73fdfd7767fcba4ae18214dccb9 100644 (file)
@@ -128,7 +128,7 @@ public class GetByProjectActionTest {
     associateProjectToQualityGate(project.getId(), dbQualityGate.getId());
     logInAsProjectUser(project);
 
-    GetByProjectWsResponse result = callByKey(project.key());
+    GetByProjectWsResponse result = callByKey(project.getDbKey());
 
     assertThat(result.getQualityGate().getName()).isEqualTo(dbQualityGate.getName());
   }
index 26f57cc43830d87317ea1a9276b821fdb4fd186f..6652fac39492731b1282d609763e5e04db55be44 100644 (file)
@@ -124,7 +124,7 @@ public class ProjectStatusActionTest {
 
   @Test
   public void return_status_by_project_key() throws IOException {
-    ComponentDto project = db.components().insertComponent(ComponentTesting.newPrivateProjectDto(db.organizations().insert()).setKey("project-key"));
+    ComponentDto project = db.components().insertComponent(ComponentTesting.newPrivateProjectDto(db.organizations().insert()).setDbKey("project-key"));
     SnapshotDto snapshot = dbClient.snapshotDao().insert(dbSession, newAnalysis(project)
       .setPeriodMode("last_version")
       .setPeriodParam("2015-12-07")
index 3ae7f8d37fad9ccb3b93df327394f96e4f51edc7..c3fd89633d161b6a828a8e6ab12b8eb05246a0c5 100644 (file)
@@ -91,7 +91,7 @@ public class SelectActionTest {
     logInAsRoot();
     String gateId = String.valueOf(gate.getId());
 
-    callByKey(gateId, project.getKey());
+    callByKey(gateId, project.getDbKey());
 
     assertSelected(gateId, project.getId());
   }
@@ -101,7 +101,7 @@ public class SelectActionTest {
     userSession.logIn().addProjectPermission(UserRole.ADMIN, project);
     String gateId = String.valueOf(gate.getId());
 
-    callByKey(gateId, project.getKey());
+    callByKey(gateId, project.getDbKey());
 
     assertSelected(gateId, project.getId());
   }
@@ -111,7 +111,7 @@ public class SelectActionTest {
     userSession.logIn().addPermission(ADMINISTER_QUALITY_GATES, project.getOrganizationUuid());
     String gateId = String.valueOf(gate.getId());
 
-    callByKey(gateId, project.getKey());
+    callByKey(gateId, project.getDbKey());
 
     assertSelected(gateId, project.getId());
   }
@@ -119,7 +119,7 @@ public class SelectActionTest {
   @Test
   public void fail_when_no_quality_gate() throws Exception {
     expectedException.expect(NotFoundException.class);
-    callByKey("1", project.getKey());
+    callByKey("1", project.getDbKey());
   }
 
   @Test
@@ -145,7 +145,7 @@ public class SelectActionTest {
     userSession.anonymous();
 
     expectedException.expect(ForbiddenException.class);
-    callByKey(gateId, project.getKey());
+    callByKey(gateId, project.getDbKey());
   }
 
   @Test
@@ -155,7 +155,7 @@ public class SelectActionTest {
     userSession.logIn().addProjectPermission(UserRole.ISSUE_ADMIN, project);
 
     expectedException.expect(ForbiddenException.class);
-    callByKey(gateId, project.getKey());
+    callByKey(gateId, project.getDbKey());
   }
 
   @Test
@@ -165,7 +165,7 @@ public class SelectActionTest {
     userSession.logIn();
 
     expectedException.expect(ForbiddenException.class);
-    callByKey(gateId, project.getKey());
+    callByKey(gateId, project.getDbKey());
   }
 
   private QualityGateDto insertQualityGate() {
index 96e02b96a42841cb49cab5f748e5beb7a23ffc1e..becad7fc7cb7b44e0e2c88e16a1ef43817e4043e 100644 (file)
@@ -260,7 +260,7 @@ public class SearchActionTest {
     db.qualityProfiles().associateWithProject(project, profileOnXoo1);
     db.qualityProfiles().setAsDefault(defaultProfileOnXoo1, defaultProfileOnXoo2);
 
-    SearchWsResponse result = call(ws.newRequest().setParam(PARAM_PROJECT_KEY, project.key()));
+    SearchWsResponse result = call(ws.newRequest().setParam(PARAM_PROJECT_KEY, project.getDbKey()));
 
     assertThat(result.getProfilesList())
       .extracting(QualityProfile::getKey)
@@ -278,7 +278,7 @@ public class SearchActionTest {
     db.qualityProfiles().associateWithProject(project, profileOnXoo1);
     db.qualityProfiles().setAsDefault(defaultProfileOnXoo1, defaultProfileOnXoo2);
 
-    SearchWsResponse result = call(ws.newRequest().setParam(PARAM_PROJECT_KEY, module.key()));
+    SearchWsResponse result = call(ws.newRequest().setParam(PARAM_PROJECT_KEY, module.getDbKey()));
 
     assertThat(result.getProfilesList())
       .extracting(QualityProfile::getKey)
@@ -296,7 +296,7 @@ public class SearchActionTest {
     db.qualityProfiles().setAsDefault(defaultProfileOnXoo1, defaultProfileOnXoo2);
 
     SearchWsResponse result = call(ws.newRequest()
-      .setParam(PARAM_PROJECT_KEY, project.key())
+      .setParam(PARAM_PROJECT_KEY, project.getDbKey())
       .setParam(PARAM_DEFAULTS, "true"));
 
     assertThat(result.getProfilesList())
@@ -314,7 +314,7 @@ public class SearchActionTest {
     db.qualityProfiles().associateWithProject(project, profileOnXoo1);
 
     SearchWsResponse result = call(ws.newRequest()
-      .setParam(PARAM_PROJECT_KEY, project.key())
+      .setParam(PARAM_PROJECT_KEY, project.getDbKey())
       .setParam(PARAM_DEFAULTS, "true"));
 
     assertThat(result.getProfilesList()).isEmpty();
@@ -336,7 +336,7 @@ public class SearchActionTest {
     expectedException.expect(IllegalStateException.class);
     expectedException.expectMessage(format("Project uuid of component uuid '%s' does not exist", module.uuid()));
 
-    call(ws.newRequest().setParam(PARAM_PROJECT_KEY, module.key()));
+    call(ws.newRequest().setParam(PARAM_PROJECT_KEY, module.getDbKey()));
   }
 
   @Test
@@ -346,11 +346,11 @@ public class SearchActionTest {
     ComponentDto project = db.components().insertPrivateProject(anotherOrganization);
 
     expectedException.expect(NotFoundException.class);
-    expectedException.expectMessage(format("Component key '%s' not found", project.getKey()));
+    expectedException.expectMessage(format("Component key '%s' not found", project.getDbKey()));
 
     call(ws.newRequest()
       .setParam(PARAM_ORGANIZATION, organization.getKey())
-      .setParam(PARAM_PROJECT_KEY, project.getKey()));
+      .setParam(PARAM_PROJECT_KEY, project.getDbKey()));
   }
 
   @Test
index 0de19099026bf5e59f442a44c56c8b105fad2ba7..962811d1bbc1d349ee92cec19f4c1e37874e8d78 100644 (file)
@@ -256,7 +256,7 @@ public class ListDefinitionsActionTest {
       .onQualifiers(PROJECT)
       .build());
 
-    ListDefinitionsWsResponse result = executeRequest(project.key());
+    ListDefinitionsWsResponse result = executeRequest(project.getDbKey());
 
     assertThat(result.getDefinitionsList()).hasSize(1);
   }
@@ -284,7 +284,7 @@ public class ListDefinitionsActionTest {
       PropertyDefinition.builder("only-on-project").onlyOnQualifiers(PROJECT).build(),
       PropertyDefinition.builder("only-on-module").onlyOnQualifiers(MODULE).build()));
 
-    ListDefinitionsWsResponse result = executeRequest(project.key());
+    ListDefinitionsWsResponse result = executeRequest(project.getDbKey());
 
     assertThat(result.getDefinitionsList()).extracting("key").containsOnly("global-and-project", "only-on-project");
   }
@@ -374,7 +374,7 @@ public class ListDefinitionsActionTest {
       PropertyDefinition.builder("secret.secured").onQualifiers(PROJECT).build(),
       PropertyDefinition.builder("plugin.license.secured").onQualifiers(PROJECT).type(PropertyType.LICENSE).build()));
 
-    ListDefinitionsWsResponse result = executeRequest(project.key());
+    ListDefinitionsWsResponse result = executeRequest(project.getDbKey());
 
     assertThat(result.getDefinitionsList()).extracting(Settings.Definition::getKey).containsOnly("foo", "secret.secured", "plugin.license.secured");
   }
@@ -386,7 +386,7 @@ public class ListDefinitionsActionTest {
 
     expectedException.expect(ForbiddenException.class);
 
-    executeRequest(project.key());
+    executeRequest(project.getDbKey());
   }
 
   @Test
index 47a48d5963d39c04b127fc8cbea75e42d980690e..db109a79337bde44247fbeb7f790f8ae516229d0 100644 (file)
@@ -359,11 +359,11 @@ public class ResetActionTest {
   }
 
   private void executeRequestOnProjectSetting(String key) {
-    executeRequest(key, project.key());
+    executeRequest(key, project.getDbKey());
   }
 
   private void executeRequestOnComponentSetting(String key, ComponentDto componentDto) {
-    executeRequest(key, componentDto.key());
+    executeRequest(key, componentDto.getDbKey());
   }
 
   private void executeRequest(String key, @Nullable String componentKey) {
index 97e03d13c6417a12b1b666b2bf8bad2a0e157d71..de69c621425d3e0dd88bf879900a6c6b55d39343 100644 (file)
@@ -135,7 +135,7 @@ public class SetActionTest {
     ComponentDto project = db.components().insertPrivateProject();
     logInAsProjectAdministrator(project);
 
-    callForProjectSettingByKey("my.key", "my project value", project.key());
+    callForProjectSettingByKey("my.key", "my project value", project.getDbKey());
 
     assertGlobalSetting("my.key", "my global value");
     assertComponentSetting("my.key", "my project value", project.getId());
@@ -147,7 +147,7 @@ public class SetActionTest {
     ComponentDto project = db.components().insertPrivateProject();
     logInAsProjectAdministrator(project);
 
-    callForProjectSettingByKey("my.key", "my value", project.key());
+    callForProjectSettingByKey("my.key", "my value", project.getDbKey());
 
     assertComponentSetting("my.key", "my value", project.getId());
   }
@@ -160,7 +160,7 @@ public class SetActionTest {
     assertComponentSetting("my.key", "my project value", project.getId());
     logInAsProjectAdministrator(project);
 
-    callForProjectSettingByKey("my.key", "my new project value", project.key());
+    callForProjectSettingByKey("my.key", "my new project value", project.getDbKey());
 
     assertComponentSetting("my.key", "my new project value", project.getId());
   }
@@ -299,10 +299,10 @@ public class SetActionTest {
     callForComponentPropertySet("my.key", newArrayList(
       GSON.toJson(ImmutableMap.of("firstField", "firstValue", "secondField", "secondValue")),
       GSON.toJson(ImmutableMap.of("firstField", "anotherFirstValue", "secondField", "anotherSecondValue"))),
-      project.key());
+      project.getDbKey());
 
     assertThat(dbClient.propertiesDao().selectGlobalProperties(dbSession)).hasSize(3);
-    assertThat(dbClient.propertiesDao().selectProjectProperties(dbSession, project.key())).hasSize(5);
+    assertThat(dbClient.propertiesDao().selectProjectProperties(dbSession, project.getDbKey())).hasSize(5);
     assertGlobalSetting("my.key", "1");
     assertGlobalSetting("my.key.1.firstField", "oldFirstValue");
     assertGlobalSetting("my.key.1.secondField", "oldSecondValue");
@@ -557,7 +557,7 @@ public class SetActionTest {
     expectedException.expectMessage("Setting 'my.key' cannot be set on a View");
     logInAsProjectAdministrator(view);
 
-    callForProjectSettingByKey("my.key", "My Value", view.key());
+    callForProjectSettingByKey("my.key", "My Value", view.getDbKey());
   }
 
   @Test
@@ -580,7 +580,7 @@ public class SetActionTest {
     expectedException.expect(BadRequestException.class);
     expectedException.expectMessage("Setting 'my.key' cannot be set on a CptLabel");
 
-    callForProjectSettingByKey("my.key", "My Value", file.key());
+    callForProjectSettingByKey("my.key", "My Value", file.getDbKey());
   }
 
   @Test
@@ -634,7 +634,7 @@ public class SetActionTest {
   private void succeedForPropertyWithoutDefinitionAndValidComponent(ComponentDto project, ComponentDto module) {
     logInAsProjectAdministrator(project);
 
-    callForProjectSettingByKey("my.key", "My Value", module.key());
+    callForProjectSettingByKey("my.key", "My Value", module.getDbKey());
 
     assertComponentSetting("my.key", "My Value", module.getId());
   }
@@ -646,7 +646,7 @@ public class SetActionTest {
     expectedException.expect(BadRequestException.class);
     expectedException.expectMessage("Setting 'my.key' cannot be set on a QualifierLabel");
 
-    callForProjectSettingByKey("my.key", "My Value", component.key());
+    callForProjectSettingByKey("my.key", "My Value", component.getDbKey());
   }
 
   @Test
@@ -895,7 +895,7 @@ public class SetActionTest {
     expectedException.expectMessage("Setting 'my.key' cannot be set on a Project");
 
     callForComponentPropertySet("my.key", newArrayList(
-      GSON.toJson(ImmutableMap.of("firstField", "firstValue"))), project.key());
+      GSON.toJson(ImmutableMap.of("firstField", "firstValue"))), project.getDbKey());
   }
 
   @Test
index c7c072ebaa442e49d3b791e1085c1a0477ede24d..172ee8f59d3809f4c46d6e853632e97011ceb50a 100644 (file)
@@ -731,7 +731,7 @@ public class ValuesActionTest {
 
     expectedException.expect(ForbiddenException.class);
 
-    executeRequest(project.key(), "foo");
+    executeRequest(project.getDbKey(), "foo");
   }
 
   @Test
@@ -789,11 +789,11 @@ public class ValuesActionTest {
   }
 
   private ValuesWsResponse executeRequestForComponentProperties(ComponentDto componentDto, String... keys) {
-    return executeRequest(componentDto.key(), keys);
+    return executeRequest(componentDto.getDbKey(), keys);
   }
 
   private ValuesWsResponse executeRequestForProjectProperties(String... keys) {
-    return executeRequest(project.key(), keys);
+    return executeRequest(project.getDbKey(), keys);
   }
 
   private ValuesWsResponse executeRequestForGlobalProperties(String... keys) {
index ea7a645904965026ce9c4bccf155bf004f3e0962..725ba85a3ddf5827b866ab2077e4cbd3410e344f 100644 (file)
@@ -62,7 +62,7 @@ public class IndexActionTest {
     insertFileWithData(file, newData("public class HelloWorld {", "}"));
 
     TestResponse request = tester.newRequest()
-      .setParam("resource", file.getKey())
+      .setParam("resource", file.getDbKey())
       .execute();
 
     assertJson(request.getInput()).isSimilarTo("[\n" +
@@ -81,7 +81,7 @@ public class IndexActionTest {
     insertFileWithData(file, newData("/**", " */", "public class HelloWorld {", "}", "", "foo"));
 
     TestResponse request = tester.newRequest()
-      .setParam("resource", file.getKey())
+      .setParam("resource", file.getDbKey())
       .setParam("from", "3")
       .setParam("to", "5")
       .execute();
@@ -103,7 +103,7 @@ public class IndexActionTest {
     expectedException.expect(ForbiddenException.class);
 
     tester.newRequest()
-      .setParam("resource", file.getKey())
+      .setParam("resource", file.getDbKey())
       .execute();
   }
 
index 4397fe3f67f186c2251852fb1d562b58ba02015c..f10745ca1d71f5c8db1c85e463221a67908ea779 100644 (file)
@@ -86,7 +86,7 @@ public class LinesActionTest {
     wsTester = new WsTester(new SourcesWs(
       new LinesAction(TestComponentFinder.from(dbTester), dbTester.getDbClient(), sourceService, htmlSourceDecorator, userSessionRule)));
     project = ComponentTesting.newPrivateProjectDto(dbTester.organizations().insert(), PROJECT_UUID);
-    file = newFileDto(project, null, FILE_UUID).setKey(FILE_KEY);
+    file = newFileDto(project, null, FILE_UUID).setDbKey(FILE_KEY);
   }
 
   @Test
@@ -149,7 +149,7 @@ public class LinesActionTest {
 
   @Test
   public void fail_when_file_is_removed() throws Exception {
-    ComponentDto file = newFileDto(project).setKey("file-key").setEnabled(false);
+    ComponentDto file = newFileDto(project).setDbKey("file-key").setEnabled(false);
     dbTester.components().insertComponents(project, file);
     setUserWithValidPermission();
 
index 636a521fc5120029009a9e87ac5313c99e817927..1f6d926376a357ac121e660e9003c6ac38356c3c 100644 (file)
@@ -64,7 +64,7 @@ public class ScmActionTest {
       new SourcesWs(new ScmAction(dbClient, new SourceService(dbTester.getDbClient(), new HtmlSourceDecorator()), userSessionRule, TestComponentFinder.from(dbTester))));
 
     project = ComponentTesting.newPrivateProjectDto(dbTester.organizations().insert(), PROJECT_UUID);
-    file = ComponentTesting.newFileDto(project, null, FILE_UUID).setKey(FILE_KEY);
+    file = ComponentTesting.newFileDto(project, null, FILE_UUID).setDbKey(FILE_KEY);
     dbClient.componentDao().insert(dbTester.getSession(), project, file);
     dbTester.getSession().commit();
   }
index 3a35213c5a410e0da0bdc9a6104ecf4969e68beb..31c19bf17b9b78fd61fc1ef0fe5f2124067d3dfc 100644 (file)
@@ -51,7 +51,7 @@ public class DisplayLogOnDeprecatedProjectsTest {
   public void display_log_on_deprecated_project() throws Exception {
     OrganizationDto organizationDto = dbTester.organizations().insert();
     dbClient.componentDao().insert(dbSession, ComponentTesting.newPrivateProjectDto(organizationDto)
-      .setKey(DEPRECATED_PROJECT_KEY)
+      .setDbKey(DEPRECATED_PROJECT_KEY)
       .setDeprecatedKey(null));
     dbSession.commit();
 
@@ -67,7 +67,7 @@ public class DisplayLogOnDeprecatedProjectsTest {
   public void not_display_log_when_task_already_executed() throws Exception {
     OrganizationDto organizationDto = dbTester.organizations().insert();
     dbClient.componentDao().insert(dbSession, ComponentTesting.newPrivateProjectDto(organizationDto)
-      .setKey(DEPRECATED_PROJECT_KEY)
+      .setDbKey(DEPRECATED_PROJECT_KEY)
       .setDeprecatedKey(null));
     dbSession.commit();
 
@@ -83,7 +83,7 @@ public class DisplayLogOnDeprecatedProjectsTest {
   public void nothing_do_when_no_deprecated_project() throws Exception {
     OrganizationDto organizationDto = dbTester.organizations().insert();
     dbClient.componentDao().insert(dbSession, ComponentTesting.newPrivateProjectDto(organizationDto)
-      .setKey(PROJECT_KEY)
+      .setDbKey(PROJECT_KEY)
       .setDeprecatedKey(PROJECT_KEY));
     dbSession.commit();
 
index 72235dcc0d7259a95280f33c44ca4a6b3a26b16a..398e77f6e02f319ea8924e608d602e05a4205f04 100644 (file)
@@ -85,8 +85,8 @@ public class CoveredFilesActionTest {
     OrganizationDto organizationDto = OrganizationTesting.newOrganizationDto();
     when(dbClient.componentDao().selectByUuids(any(DbSession.class), anyList())).thenReturn(
       Arrays.asList(
-        newFileDto(ComponentTesting.newPrivateProjectDto(organizationDto), null, FILE_1_ID).setKey("org.foo.Bar.java").setLongName("src/main/java/org/foo/Bar.java"),
-        newFileDto(ComponentTesting.newPrivateProjectDto(organizationDto), null, FILE_2_ID).setKey("org.foo.File.java").setLongName("src/main/java/org/foo/File.java")));
+        newFileDto(ComponentTesting.newPrivateProjectDto(organizationDto), null, FILE_1_ID).setDbKey("org.foo.Bar.java").setLongName("src/main/java/org/foo/Bar.java"),
+        newFileDto(ComponentTesting.newPrivateProjectDto(organizationDto), null, FILE_2_ID).setDbKey("org.foo.File.java").setLongName("src/main/java/org/foo/File.java")));
 
     TestRequest request = ws.newRequest().setParam(TEST_ID, "test-uuid");
 
@@ -106,8 +106,8 @@ public class CoveredFilesActionTest {
     OrganizationDto organizationDto = OrganizationTesting.newOrganizationDto();
     when(dbClient.componentDao().selectByUuids(any(DbSession.class), anyList())).thenReturn(
       Arrays.asList(
-        newFileDto(ComponentTesting.newPrivateProjectDto(organizationDto), null, FILE_1_ID).setKey("org.foo.Bar.java").setLongName("src/main/java/org/foo/Bar.java"),
-        newFileDto(ComponentTesting.newPrivateProjectDto(organizationDto), null, FILE_2_ID).setKey("org.foo.File.java").setLongName("src/main/java/org/foo/File.java")));
+        newFileDto(ComponentTesting.newPrivateProjectDto(organizationDto), null, FILE_1_ID).setDbKey("org.foo.Bar.java").setLongName("src/main/java/org/foo/Bar.java"),
+        newFileDto(ComponentTesting.newPrivateProjectDto(organizationDto), null, FILE_2_ID).setDbKey("org.foo.File.java").setLongName("src/main/java/org/foo/File.java")));
 
     expectedException.expect(NotFoundException.class);
     expectedException.expectMessage("Test with id 'test-uuid' is not found");
index 729b7afcbc7d9b1b1b5a57ae3cde9fa4603296bb..7c804bdf59a3be861e5354b3df9bbdbd6ef59e43 100644 (file)
@@ -101,7 +101,7 @@ public class ListActionTest {
     assertThat(result.getName()).isEqualTo(test.getName());
     assertThat(result.getStatus()).isEqualTo(WsTests.TestStatus.OK);
     assertThat(result.getFileId()).isEqualTo(testFile.uuid());
-    assertThat(result.getFileKey()).isEqualTo(testFile.key());
+    assertThat(result.getFileKey()).isEqualTo(testFile.getDbKey());
     assertThat(result.getFileName()).isEqualTo(testFile.path());
     assertThat(result.getDurationInMs()).isEqualTo(test.getExecutionTimeMs());
     assertThat(result.getMessage()).isEqualTo(test.getMsg());
@@ -146,7 +146,7 @@ public class ListActionTest {
     insertTests(testFile, test1, test2);
     insertTests(anotherTestFile, test3);
 
-    ListResponse request = call(ws.newRequest().setParam(TEST_FILE_KEY, testFile.key()));
+    ListResponse request = call(ws.newRequest().setParam(TEST_FILE_KEY, testFile.getDbKey()));
 
     assertThat(request.getTestsList()).extracting(WsTests.Test::getId).containsOnly(test1.getUuid(), test2.getUuid());
   }
@@ -176,7 +176,7 @@ public class ListActionTest {
     DbFileSources.Test test4 = newTest(anotherMainFile, 11).build();
     insertTests(testFile, test1, test2, test3, test4);
 
-    ListResponse request = call(ws.newRequest().setParam(SOURCE_FILE_KEY, mainFile.key()).setParam(SOURCE_FILE_LINE_NUMBER, "10"));
+    ListResponse request = call(ws.newRequest().setParam(SOURCE_FILE_KEY, mainFile.getDbKey()).setParam(SOURCE_FILE_LINE_NUMBER, "10"));
 
     assertThat(request.getTestsList()).extracting(WsTests.Test::getId).containsOnly(test1.getUuid(), test3.getUuid());
   }
@@ -234,7 +234,7 @@ public class ListActionTest {
     insertTests(testFile, newTest(mainFile, 10).build());
 
     expectedException.expect(ForbiddenException.class);
-    call(ws.newRequest().setParam(TEST_FILE_KEY, testFile.key()));
+    call(ws.newRequest().setParam(TEST_FILE_KEY, testFile.getDbKey()));
   }
 
   @Test
index 93545bdf5f928087c8b52c6150861028160abfff..dac9421f6d7b3319db44655c1cdc549ddf761edc 100644 (file)
@@ -105,7 +105,7 @@ public class ComponentActionTest {
   public void before() {
     OrganizationDto organization = dbTester.organizations().insertForKey("my-org");
     project = newPrivateProjectDto(organization, "abcd")
-      .setKey("polop")
+      .setDbKey("polop")
       .setName("Polop")
       .setDescription("test project")
       .setLanguage("xoo");
@@ -145,7 +145,7 @@ public class ComponentActionTest {
     init();
 
     expectedException.expect(NotFoundException.class);
-    execute(project.key());
+    execute(project.getDbKey());
   }
 
   @Test
@@ -155,7 +155,7 @@ public class ComponentActionTest {
     userSession.logIn();
 
     expectedException.expect(ForbiddenException.class);
-    execute(project.key());
+    execute(project.getDbKey());
   }
 
   @Test
@@ -164,7 +164,7 @@ public class ComponentActionTest {
     componentDbTester.insertComponent(project);
     userSession.logIn().addProjectPermission(UserRole.USER, project);
 
-    verifySuccess(project.key());
+    verifySuccess(project.getDbKey());
   }
 
   @Test
@@ -173,7 +173,7 @@ public class ComponentActionTest {
     componentDbTester.insertComponent(project);
     userSession.logIn().addProjectPermission(UserRole.ADMIN, project);
 
-    verifySuccess(project.key());
+    verifySuccess(project.getDbKey());
   }
 
   @Test
@@ -182,7 +182,7 @@ public class ComponentActionTest {
     componentDbTester.insertComponent(project);
     userSession.logIn().setSystemAdministrator();
 
-    verifySuccess(project.key());
+    verifySuccess(project.getDbKey());
   }
 
   @Test
@@ -191,7 +191,7 @@ public class ComponentActionTest {
     componentDbTester.insertComponent(project);
     userSession.addProjectPermission(UserRole.USER, project);
 
-    executeAndVerify(project.key(), "return_component_info_when_anonymous_no_snapshot.json");
+    executeAndVerify(project.getDbKey(), "return_component_info_when_anonymous_no_snapshot.json");
   }
 
   @Test
@@ -202,7 +202,7 @@ public class ComponentActionTest {
     propertyDbTester.insertProperty(new PropertyDto().setKey("favourite").setResourceId(project.getId()).setUserId(user.getId()));
     userSession.logIn(user).addProjectPermission(UserRole.USER, project);
 
-    executeAndVerify(project.key(), "return_component_info_with_favourite.json");
+    executeAndVerify(project.getDbKey(), "return_component_info_with_favourite.json");
   }
 
   @Test
@@ -215,7 +215,7 @@ public class ComponentActionTest {
       .setLast(true));
     userSession.addProjectPermission(UserRole.USER, project);
 
-    executeAndVerify(project.key(), "return_component_info_when_snapshot.json");
+    executeAndVerify(project.getDbKey(), "return_component_info_when_snapshot.json");
   }
 
   @Test
@@ -228,7 +228,7 @@ public class ComponentActionTest {
       createQProfile("qp2", "Sonar Way Xoo", "xoo"));
     userSession.addProjectPermission(UserRole.USER, project);
 
-    executeAndVerify(project.key(), "return_quality_profiles.json");
+    executeAndVerify(project.getDbKey(), "return_quality_profiles.json");
   }
 
   @Test
@@ -237,7 +237,7 @@ public class ComponentActionTest {
     componentDbTester.insertComponent(project);
     userSession.addProjectPermission(UserRole.USER, project);
 
-    executeAndVerify(project.key(), "return_empty_quality_profiles_when_no_measure.json");
+    executeAndVerify(project.getDbKey(), "return_empty_quality_profiles_when_no_measure.json");
   }
 
   @Test
@@ -248,7 +248,7 @@ public class ComponentActionTest {
     dbTester.qualityGates().associateProjectToQualityGate(project, qualityGateDto);
     userSession.addProjectPermission(UserRole.USER, project);
 
-    executeAndVerify(project.key(), "return_quality_gate.json");
+    executeAndVerify(project.getDbKey(), "return_quality_gate.json");
   }
 
   @Test
@@ -258,7 +258,7 @@ public class ComponentActionTest {
     dbTester.qualityGates().createDefaultQualityGate("Sonar way");
     userSession.addProjectPermission(UserRole.USER, project);
 
-    executeAndVerify(project.key(), "return_default_quality_gate.json");
+    executeAndVerify(project.getDbKey(), "return_default_quality_gate.json");
   }
 
   @Test
@@ -267,7 +267,7 @@ public class ComponentActionTest {
     componentDbTester.insertComponent(project);
     userSession.addProjectPermission(UserRole.USER, project);
 
-    String json = execute(project.key());
+    String json = execute(project.getDbKey());
     assertThat(json).doesNotContain("qualityGate");
   }
 
@@ -277,7 +277,7 @@ public class ComponentActionTest {
     componentDbTester.insertComponent(project);
     userSession.anonymous().addProjectPermission(UserRole.USER, project);
 
-    executeAndVerify(project.key(), "return_extensions.json");
+    executeAndVerify(project.getDbKey(), "return_extensions.json");
   }
 
   @Test
@@ -293,7 +293,7 @@ public class ComponentActionTest {
     userSession.registerComponents(application);
 
     String result = ws.newRequest()
-      .setParam(PARAM_COMPONENT, application.key())
+      .setParam(PARAM_COMPONENT, application.getDbKey())
       .execute().getInput();
 
     assertThat(result).contains("my_plugin/app_page");
@@ -307,7 +307,7 @@ public class ComponentActionTest {
       .addProjectPermission(UserRole.USER, project)
       .addProjectPermission(UserRole.ADMIN, project);
 
-    executeAndVerify(project.key(), "return_extensions_for_admin.json");
+    executeAndVerify(project.getDbKey(), "return_extensions_for_admin.json");
   }
 
   @Test
@@ -332,7 +332,7 @@ public class ComponentActionTest {
       .build();
 
     init(page1, page2);
-    executeAndVerify(project.key(), "return_configuration_for_admin.json");
+    executeAndVerify(project.getDbKey(), "return_configuration_for_admin.json");
   }
 
   @Test
@@ -354,19 +354,19 @@ public class ComponentActionTest {
     when(resourceTypes.get(project.qualifier()))
       .thenReturn(projectResourceType);
 
-    executeAndVerify(project.key(), "return_configuration_with_all_properties.json");
+    executeAndVerify(project.getDbKey(), "return_configuration_with_all_properties.json");
   }
 
   @Test
   public void return_breadcrumbs_on_module() throws Exception {
     init();
     ComponentDto project = componentDbTester.insertComponent(this.project);
-    ComponentDto module = componentDbTester.insertComponent(newModuleDto("bcde", project).setKey("palap").setName("Palap"));
+    ComponentDto module = componentDbTester.insertComponent(newModuleDto("bcde", project).setDbKey("palap").setName("Palap"));
     userSession.anonymous()
       .addProjectPermission(UserRole.USER, project)
       .addProjectPermission(UserRole.ADMIN, project);
 
-    executeAndVerify(module.key(), "return_breadcrumbs_on_module.json");
+    executeAndVerify(module.getDbKey(), "return_breadcrumbs_on_module.json");
   }
 
   @Test
@@ -377,7 +377,7 @@ public class ComponentActionTest {
       .addProjectPermission(UserRole.USER, project)
       .addPermission(ADMINISTER_QUALITY_PROFILES, project.getOrganizationUuid());
 
-    executeAndVerify(project.key(), "return_configuration_for_quality_profile_admin.json");
+    executeAndVerify(project.getDbKey(), "return_configuration_for_quality_profile_admin.json");
   }
 
   @Test
@@ -388,21 +388,21 @@ public class ComponentActionTest {
       .addProjectPermission(UserRole.USER, project)
       .addPermission(ADMINISTER_QUALITY_GATES, project.getOrganizationUuid());
 
-    executeAndVerify(project.key(), "return_configuration_for_quality_gate_admin.json");
+    executeAndVerify(project.getDbKey(), "return_configuration_for_quality_gate_admin.json");
   }
 
   @Test
   public void return_bread_crumbs_on_several_levels() throws Exception {
     init();
     ComponentDto project = componentDbTester.insertComponent(this.project);
-    ComponentDto module = componentDbTester.insertComponent(newModuleDto("bcde", project).setKey("palap").setName("Palap"));
+    ComponentDto module = componentDbTester.insertComponent(newModuleDto("bcde", project).setDbKey("palap").setName("Palap"));
     ComponentDto directory = componentDbTester.insertComponent(newDirectory(module, "src/main/xoo"));
     ComponentDto file = componentDbTester.insertComponent(newFileDto(directory, directory, "cdef").setName("Source.xoo")
-      .setKey("palap:src/main/xoo/Source.xoo")
+      .setDbKey("palap:src/main/xoo/Source.xoo")
       .setPath(directory.path()));
     userSession.addProjectPermission(UserRole.USER, project);
 
-    executeAndVerify(file.key(), "return_bread_crumbs_on_several_levels.json");
+    executeAndVerify(file.getDbKey(), "return_bread_crumbs_on_several_levels.json");
   }
 
   @Test
@@ -411,7 +411,7 @@ public class ComponentActionTest {
     componentDbTester.insertProjectAndSnapshot(project);
     userSession.addProjectPermission(UserRole.ADMIN, project);
 
-    execute(project.key());
+    execute(project.getDbKey());
   }
 
   @Test
@@ -419,7 +419,7 @@ public class ComponentActionTest {
     init(createPages());
     OrganizationDto organizationDto = dbTester.organizations().insertForKey("my-org-1");
     ComponentDto project = newPrivateProjectDto(organizationDto, "ABCD")
-      .setKey("org.codehaus.sonar:sonar")
+      .setDbKey("org.codehaus.sonar:sonar")
       .setName("Sonarqube")
       .setDescription("Open source platform for continuous inspection of code quality");
     componentDbTester.insertComponent(project);
@@ -440,7 +440,7 @@ public class ComponentActionTest {
       .addProjectPermission(UserRole.USER, project)
       .addProjectPermission(UserRole.ADMIN, project);
 
-    String result = execute(project.key());
+    String result = execute(project.getDbKey());
     assertJson(result).ignoreFields("snapshotDate", "key", "qualityGate.key").isSimilarTo(ws.getDef().responseExampleAsString());
   }
 
@@ -453,7 +453,7 @@ public class ComponentActionTest {
     userSession.logIn()
       .addProjectPermission(UserRole.ADMIN, project)
       .addPermission(OrganizationPermission.ADMINISTER, org);
-    assertJson(execute(project.key())).isSimilarTo("{\"visibility\": \"private\"}");
+    assertJson(execute(project.getDbKey())).isSimilarTo("{\"visibility\": \"private\"}");
   }
 
   @Test
@@ -465,7 +465,7 @@ public class ComponentActionTest {
     userSession.logIn()
       .addProjectPermission(UserRole.ADMIN, project)
       .addPermission(OrganizationPermission.ADMINISTER, org);
-    assertJson(execute(project.key())).isSimilarTo("{\"visibility\": \"public\"}");
+    assertJson(execute(project.getDbKey())).isSimilarTo("{\"visibility\": \"public\"}");
   }
 
   @Test
@@ -478,7 +478,7 @@ public class ComponentActionTest {
     userSession.logIn()
       .addProjectPermission(UserRole.ADMIN, project)
       .addPermission(OrganizationPermission.ADMINISTER, org);
-    String json = execute(module.key());
+    String json = execute(module.getDbKey());
     assertThat(json).doesNotContain("visibility");
   }
 
@@ -491,12 +491,12 @@ public class ComponentActionTest {
     userSession.logIn()
       .addProjectPermission(UserRole.ADMIN, project)
       .addPermission(OrganizationPermission.ADMINISTER, org);
-    assertJson(execute(project.key())).isSimilarTo("{\"configuration\": {\"canApplyPermissionTemplate\": true}}");
+    assertJson(execute(project.getDbKey())).isSimilarTo("{\"configuration\": {\"canApplyPermissionTemplate\": true}}");
 
     userSession.logIn()
       .addProjectPermission(UserRole.ADMIN, project);
 
-    assertJson(execute(project.key())).isSimilarTo("{\"configuration\": {\"canApplyPermissionTemplate\": false}}");
+    assertJson(execute(project.getDbKey())).isSimilarTo("{\"configuration\": {\"canApplyPermissionTemplate\": false}}");
   }
 
   @Test
@@ -507,11 +507,11 @@ public class ComponentActionTest {
 
     userSession.logIn().addProjectPermission(UserRole.ADMIN, project);
     when(billingValidations.canUpdateProjectVisibilityToPrivate(any(BillingValidations.Organization.class))).thenReturn(false);
-    assertJson(execute(project.key())).isSimilarTo("{\"configuration\": {\"canUpdateProjectVisibilityToPrivate\": false}}");
+    assertJson(execute(project.getDbKey())).isSimilarTo("{\"configuration\": {\"canUpdateProjectVisibilityToPrivate\": false}}");
 
     userSession.logIn().addProjectPermission(UserRole.ADMIN, project);
     when(billingValidations.canUpdateProjectVisibilityToPrivate(any(BillingValidations.Organization.class))).thenReturn(true);
-    assertJson(execute(project.key())).isSimilarTo("{\"configuration\": {\"canUpdateProjectVisibilityToPrivate\": true}}");
+    assertJson(execute(project.getDbKey())).isSimilarTo("{\"configuration\": {\"canUpdateProjectVisibilityToPrivate\": true}}");
   }
 
   private void init(Page... pages) {
index ed73fca1371ab8e07ab812e03efbbe97c01e093a..aa7f673da1dbf27798591b33695e4db9bacffea2 100644 (file)
@@ -84,7 +84,7 @@ public class ServerUserSessionTest {
     organization = db.organizations().insert();
     publicProject = db.components().insertPublicProject(organization, PUBLIC_PROJECT_UUID);
     privateProject = db.components().insertPrivateProject(organization, dto -> dto.setUuid(PRIVATE_PROJECT_UUID).setProjectUuid(PRIVATE_PROJECT_UUID).setPrivate(true));
-    db.components().insertComponent(ComponentTesting.newFileDto(publicProject, null, FILE_UUID).setKey(FILE_KEY));
+    db.components().insertComponent(ComponentTesting.newFileDto(publicProject, null, FILE_UUID).setDbKey(FILE_KEY));
     user = db.users().insertUser(LOGIN);
     groupOfUser = db.users().insertGroup(organization);
   }
index 34528ec49e146905906c890d3ca6025061c913a1..750a7ca966505f5a8c83873842a0b8a6edae8a53 100644 (file)
@@ -63,7 +63,7 @@ public class WebhookDeliveriesActionTest {
     ComponentFinder componentFinder = TestComponentFinder.from(db);
     WebhookDeliveriesAction underTest = new WebhookDeliveriesAction(dbClient, userSession, componentFinder);
     ws = new WsActionTester(underTest);
-    project = db.components().insertComponent(ComponentTesting.newPrivateProjectDto(db.organizations().insert()).setKey("my-project"));
+    project = db.components().insertComponent(ComponentTesting.newPrivateProjectDto(db.organizations().insert()).setDbKey("my-project"));
   }
 
   @Test
@@ -86,7 +86,7 @@ public class WebhookDeliveriesActionTest {
     userSession.logIn().addProjectPermission(UserRole.ADMIN, project);
 
     Webhooks.DeliveriesWsResponse response = ws.newRequest()
-      .setParam("componentKey", project.getKey())
+      .setParam("componentKey", project.getDbKey())
       .executeProtobuf(Webhooks.DeliveriesWsResponse.class);
 
     assertThat(response.getDeliveriesCount()).isEqualTo(0);
@@ -120,7 +120,7 @@ public class WebhookDeliveriesActionTest {
     userSession.logIn().addProjectPermission(UserRole.ADMIN, project);
 
     String json = ws.newRequest()
-      .setParam("componentKey", project.getKey())
+      .setParam("componentKey", project.getDbKey())
       .execute()
       .getInput();
 
@@ -157,7 +157,7 @@ public class WebhookDeliveriesActionTest {
     expectedException.expectMessage("Insufficient privileges");
 
     ws.newRequest()
-      .setParam("componentKey", project.getKey())
+      .setParam("componentKey", project.getDbKey())
       .execute();
   }
 
@@ -185,7 +185,7 @@ public class WebhookDeliveriesActionTest {
     expectedException.expectMessage("Either parameter 'ceTaskId' or 'componentKey' must be defined");
 
     ws.newRequest()
-      .setParam("componentKey", project.getKey())
+      .setParam("componentKey", project.getDbKey())
       .setParam("ceTaskId", "t1")
       .execute();
   }
index b9fa4d05adcc47c22883bd875053062d8d40d88a..3edfaf85e31a8ec1429dc7abff0f506a6c51cfeb 100644 (file)
@@ -65,7 +65,7 @@ public class WebhookDeliveryActionTest {
     ComponentFinder componentFinder = TestComponentFinder.from(db);
     WebhookDeliveryAction underTest = new WebhookDeliveryAction(dbClient, userSession, componentFinder);
     ws = new WsActionTester(underTest);
-    project = db.components().insertComponent(ComponentTesting.newPrivateProjectDto(db.organizations().insert()).setKey("my-project"));
+    project = db.components().insertComponent(ComponentTesting.newPrivateProjectDto(db.organizations().insert()).setDbKey("my-project"));
   }
 
   @Test