aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2023-01-26 15:06:06 -0600
committersonartech <sonartech@sonarsource.com>2023-02-02 20:03:40 +0000
commit5efe3d77752f25e199d5f3c4417788f05e7832cb (patch)
treed9b21649c7531bfe6e96a309f0adfa1be84c8260 /server
parent888b2dad0c98f714abc08a812129c58a90f10494 (diff)
downloadsonarqube-5efe3d77752f25e199d5f3c4417788f05e7832cb.tar.gz
sonarqube-5efe3d77752f25e199d5f3c4417788f05e7832cb.zip
SONAR-17706 Remove root_uuid in Components and all its uses
Diffstat (limited to 'server')
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/EnableAnalysisStep.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/PersistComponentsStep.java22
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistDuplicationDataStepTest.java1
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistLiveMeasuresStepTest.java1
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistMeasuresStepTest.java1
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportPersistComponentsStepTest.java16
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsPersistComponentsStepTest.java12
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/analysis/ExportAnalysesStepTest.java3
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/branches/ExportBranchesStepTest.java1
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/component/ExportComponentsStepTest.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/rule/ExportAdHocRulesStepTest.java1
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/steps/ExportEventsStepTest.java1
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/steps/ExportLinksStepTest.java1
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/steps/ExportMeasuresStepTest.java3
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/steps/ExportNewCodePeriodsStepTest.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/steps/ExportSettingsStepTest.java2
-rw-r--r--server/sonar-ce/src/test/java/org/sonar/ce/queue/NextPendingTaskPickerTest.java2
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDao.java16
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDto.java27
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentKeyUpdaterMapper.java2
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentMapper.java6
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/component/ResourceDto.java10
-rw-r--r--server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentKeyUpdaterMapper.xml3
-rw-r--r--server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentMapper.xml12
-rw-r--r--server/sonar-db-dao/src/schema/schema-sq.ddl2
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java21
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDtoTest.java4
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentKeyUpdaterDaoTest.java2
-rw-r--r--server/sonar-db-dao/src/test/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date-result.xml5
-rw-r--r--server/sonar-db-dao/src/test/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date.xml5
-rw-r--r--server/sonar-db-dao/src/test/resources/org/sonar/db/issue/IssueDaoTest/shared.xml12
-rw-r--r--server/sonar-db-dao/src/test/resources/org/sonar/db/measure/MeasureDaoTest/past_measures.xml15
-rw-r--r--server/sonar-db-dao/src/test/resources/org/sonar/db/measure/MeasureDaoTest/select_by_snapshot_and_metric_keys.xml1
-rw-r--r--server/sonar-db-dao/src/test/resources/org/sonar/db/measure/MeasureDaoTest/shared.xml1
-rw-r--r--server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/should_return_root_project_keys_for_anonymous.xml8
-rw-r--r--server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/should_return_root_project_keys_for_group.xml8
-rw-r--r--server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/should_return_root_project_keys_for_user.xml8
-rw-r--r--server/sonar-db-dao/src/testFixtures/java/org/sonar/db/component/ComponentTesting.java6
-rw-r--r--server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v100/DbVersion100.java4
-rw-r--r--server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v100/DropIndexProjectsRootUuidInComponents.java32
-rw-r--r--server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v100/DropRootUuidInComponents.java32
-rw-r--r--server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropIndexProjectsRootUuidInComponentsTest.java51
-rw-r--r--server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropRootUuidInComponentsTest.java51
-rw-r--r--server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropIndexProjectsRootUuidInComponentsTest/schema.sql37
-rw-r--r--server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropRootUuidInComponentsTest/schema.sql37
-rw-r--r--server/sonar-server-common/src/test/java/org/sonar/server/component/index/ComponentIndexerTest.java2
-rw-r--r--server/sonar-server-common/src/test/resources/org/sonar/server/issue/index/IssueIndexerTest/index.xml6
-rw-r--r--server/sonar-server-common/src/test/resources/org/sonar/server/issue/index/IssueIndexerTest/index_project.xml12
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/user/ServerUserSessionTest.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ComponentUpdater.java1
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/project/ws/UpdateVisibilityAction.java4
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/batch/ProjectDataLoaderTest.java1
52 files changed, 295 insertions, 226 deletions
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/EnableAnalysisStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/EnableAnalysisStep.java
index edcf3d9d60b..c59894f568d 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/EnableAnalysisStep.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/EnableAnalysisStep.java
@@ -43,7 +43,7 @@ public class EnableAnalysisStep implements ComputationStep {
try (DbSession dbSession = dbClient.openSession(false)) {
Component project = treeRootHolder.getRoot();
dbClient.snapshotDao().switchIsLastFlagAndSetProcessedStatus(dbSession, project.getUuid(), analysisMetadataHolder.getUuid());
- dbClient.componentDao().applyBChangesForRootComponentUuid(dbSession, project.getUuid());
+ dbClient.componentDao().applyBChangesForBranchUuid(dbSession, project.getUuid());
dbSession.commit();
}
}
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/PersistComponentsStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/PersistComponentsStep.java
index f120c211950..8e591b95e81 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/PersistComponentsStep.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/PersistComponentsStep.java
@@ -26,7 +26,6 @@ import java.util.Optional;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
-import java.util.stream.StreamSupport;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import org.apache.commons.lang.StringUtils;
@@ -94,7 +93,7 @@ public class PersistComponentsStep implements ComputationStep {
String projectUuid = treeRootHolder.getRoot().getUuid();
// safeguard, reset all rows to b-changed=false
- dbClient.componentDao().resetBChangedForRootComponentUuid(dbSession, projectUuid);
+ dbClient.componentDao().resetBChangedForBranchUuid(dbSession, projectUuid);
Map<String, ComponentDto> existingDtosByUuids = indexExistingDtosByUuids(dbSession);
boolean isRootPrivate = isRootPrivate(treeRootHolder.getRoot(), existingDtosByUuids);
@@ -106,7 +105,7 @@ public class PersistComponentsStep implements ComputationStep {
.visit(treeRootHolder.getRoot());
disableRemainingComponents(dbSession, existingDtosByUuids.values());
- dbClient.componentDao().setPrivateForRootComponentUuidWithoutAudit(dbSession, projectUuid, isRootPrivate);
+ dbClient.componentDao().setPrivateForBranchUuidWithoutAudit(dbSession, projectUuid, isRootPrivate);
dbSession.commit();
}
}
@@ -262,7 +261,6 @@ public class PersistComponentsStep implements ComputationStep {
res.setDescription(project.getDescription());
res.setBranchUuid(res.uuid());
- res.setRootUuid(res.uuid());
res.setUuidPath(UUID_PATH_OF_ROOT);
return res;
@@ -277,7 +275,7 @@ public class PersistComponentsStep implements ComputationStep {
res.setLongName(directory.getName());
res.setPath(directory.getName());
- setParentProperties(res, path);
+ setUuids(res, path);
return res;
}
@@ -292,7 +290,7 @@ public class PersistComponentsStep implements ComputationStep {
res.setPath(file.getName());
res.setLanguage(file.getFileAttributes().getLanguageKey());
- setParentProperties(res, path);
+ setUuids(res, path);
return res;
}
@@ -307,7 +305,6 @@ public class PersistComponentsStep implements ComputationStep {
res.setLongName(res.name());
res.setBranchUuid(res.uuid());
- res.setRootUuid(res.uuid());
res.setUuidPath(UUID_PATH_OF_ROOT);
return res;
@@ -361,7 +358,6 @@ public class PersistComponentsStep implements ComputationStep {
*/
private void setRootAndParentModule(ComponentDto res, PathAwareVisitor.Path<ComponentDtoHolder> path) {
ComponentDto rootDto = path.root().getDto();
- res.setRootUuid(rootDto.uuid());
res.setBranchUuid(rootDto.uuid());
ComponentDto parent = path.parent().getDto();
@@ -372,17 +368,9 @@ public class PersistComponentsStep implements ComputationStep {
/**
* Applies to a node of type either DIRECTORY or FILE
*/
- private static void setParentProperties(ComponentDto componentDto, PathAwareVisitor.Path<ComponentDtoHolder> path) {
+ private static void setUuids(ComponentDto componentDto, PathAwareVisitor.Path<ComponentDtoHolder> path) {
componentDto.setBranchUuid(path.root().getDto().uuid());
-
- ComponentDto parent = StreamSupport.stream(path.getCurrentPath().spliterator(), false)
- .filter(p -> p.component().getType() == Component.Type.PROJECT)
- .findFirst()
- .get()
- .element().getDto();
componentDto.setUuidPath(formatUuidPathFromParent(path.parent().getDto()));
- componentDto.setRootUuid(parent.uuid());
-
}
private static Optional<ComponentUpdateDto> compareForUpdate(ComponentDto existing, ComponentDto target) {
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistDuplicationDataStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistDuplicationDataStepTest.java
index 708fea9df3a..3488d4fc441 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistDuplicationDataStepTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistDuplicationDataStepTest.java
@@ -178,7 +178,6 @@ public class PersistDuplicationDataStepTest extends BaseStepTest {
.setKey(key)
.setUuid(uuid)
.setUuidPath(uuid + ".")
- .setRootUuid(uuid)
.setBranchUuid(uuid);
db.components().insertComponent(componentDto);
return componentDto;
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistLiveMeasuresStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistLiveMeasuresStepTest.java
index da3bc80b038..1620edc22e5 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistLiveMeasuresStepTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistLiveMeasuresStepTest.java
@@ -306,7 +306,6 @@ public class PersistLiveMeasuresStepTest extends BaseStepTest {
.setKey(key)
.setUuid(uuid)
.setUuidPath(uuid + ".")
- .setRootUuid(uuid)
.setBranchUuid(uuid);
db.components().insertComponent(componentDto);
return componentDto;
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistMeasuresStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistMeasuresStepTest.java
index a6542410c70..f1db84273db 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistMeasuresStepTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistMeasuresStepTest.java
@@ -225,7 +225,6 @@ public class PersistMeasuresStepTest extends BaseStepTest {
.setKey(key)
.setUuid(uuid)
.setUuidPath(uuid + ".")
- .setRootUuid(uuid)
.setBranchUuid(uuid);
db.components().insertComponent(componentDto);
return componentDto;
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportPersistComponentsStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportPersistComponentsStepTest.java
index 28bb7d9be16..c47def416d8 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportPersistComponentsStepTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportPersistComponentsStepTest.java
@@ -126,7 +126,6 @@ public class ReportPersistComponentsStepTest extends BaseStepTest {
assertThat(directoryDto.branchUuid()).isEqualTo(projectDto.uuid());
assertThat(directoryDto.qualifier()).isEqualTo("DIR");
assertThat(directoryDto.scope()).isEqualTo("DIR");
- assertThat(directoryDto.getRootUuid()).isEqualTo(projectDto.uuid());
assertThat(directoryDto.getCreatedAt()).isEqualTo(now);
ComponentDto fileDto = dbClient.componentDao().selectByKey(db.getSession(), "PROJECT_KEY:src/main/java/dir/Foo.java").get();
@@ -141,7 +140,6 @@ public class ReportPersistComponentsStepTest extends BaseStepTest {
assertThat(fileDto.branchUuid()).isEqualTo(projectDto.uuid());
assertThat(fileDto.qualifier()).isEqualTo("FIL");
assertThat(fileDto.scope()).isEqualTo("FIL");
- assertThat(fileDto.getRootUuid()).isEqualTo(projectDto.uuid());
assertThat(fileDto.getCreatedAt()).isEqualTo(now);
}
@@ -180,7 +178,6 @@ public class ReportPersistComponentsStepTest extends BaseStepTest {
assertThat(directoryDto.branchUuid()).isEqualTo(branch.uuid());
assertThat(directoryDto.qualifier()).isEqualTo("DIR");
assertThat(directoryDto.scope()).isEqualTo("DIR");
- assertThat(directoryDto.getRootUuid()).isEqualTo(branch.uuid());
assertThat(directoryDto.getCreatedAt()).isEqualTo(now);
ComponentDto fileDto = dbClient.componentDao().selectByKeyAndBranch(db.getSession(), "PROJECT_KEY:src/main/java/dir/Foo.java", "feature/foo").get();
@@ -195,7 +192,6 @@ public class ReportPersistComponentsStepTest extends BaseStepTest {
assertThat(fileDto.branchUuid()).isEqualTo(branch.uuid());
assertThat(fileDto.qualifier()).isEqualTo("FIL");
assertThat(fileDto.scope()).isEqualTo("FIL");
- assertThat(fileDto.getRootUuid()).isEqualTo(branch.uuid());
assertThat(fileDto.getCreatedAt()).isEqualTo(now);
}
@@ -278,7 +274,7 @@ public class ReportPersistComponentsStepTest extends BaseStepTest {
underTest.execute(new TestComputationStepContext());
// commit the functional transaction
- dbClient.componentDao().applyBChangesForRootComponentUuid(db.getSession(), project.uuid());
+ dbClient.componentDao().applyBChangesForBranchUuid(db.getSession(), project.uuid());
db.commit();
assertThat(dbClient.componentDao().selectByKey(db.getSession(), PROJECT_KEY + ":src/foo").get().scope()).isEqualTo("DIR");
@@ -316,13 +312,11 @@ public class ReportPersistComponentsStepTest extends BaseStepTest {
ComponentDto directory = dbClient.componentDao().selectByKey(db.getSession(), "PROJECT_KEY:src/main/java/dir").get();
assertThat(directory.getUuidPath()).isEqualTo(directory.getUuidPath());
assertThat(directory.branchUuid()).isEqualTo(project.uuid());
- assertThat(directory.getRootUuid()).isEqualTo(project.uuid());
assertThat(directory.getMainBranchProjectUuid()).isNull();
ComponentDto file = dbClient.componentDao().selectByKey(db.getSession(), "PROJECT_KEY:src/main/java/dir/Foo.java").get();
assertThat(file.getUuidPath()).isEqualTo(file.getUuidPath());
assertThat(file.branchUuid()).isEqualTo(project.uuid());
- assertThat(file.getRootUuid()).isEqualTo(project.uuid());
assertThat(file.getMainBranchProjectUuid()).isNull();
}
@@ -358,13 +352,11 @@ public class ReportPersistComponentsStepTest extends BaseStepTest {
ComponentDto projectReloaded = dbClient.componentDao().selectByKey(db.getSession(), project.getKey()).get();
assertThat(projectReloaded.uuid()).isEqualTo(project.uuid());
assertThat(projectReloaded.branchUuid()).isEqualTo(project.branchUuid());
- assertThat(projectReloaded.getRootUuid()).isEqualTo(project.getRootUuid());
ComponentDto directoryReloaded = dbClient.componentDao().selectByKey(db.getSession(), "PROJECT_KEY:src/main/java/dir").get();
assertThat(directoryReloaded.uuid()).isEqualTo(directory.uuid());
assertThat(directoryReloaded.getUuidPath()).isEqualTo(directory.getUuidPath());
assertThat(directoryReloaded.branchUuid()).isEqualTo(directory.branchUuid());
- assertThat(directoryReloaded.getRootUuid()).isEqualTo(directory.getRootUuid());
assertThat(directoryReloaded.name()).isEqualTo(directory.name());
assertThat(directoryReloaded.path()).isEqualTo(directory.path());
@@ -372,7 +364,6 @@ public class ReportPersistComponentsStepTest extends BaseStepTest {
assertThat(fileReloaded.uuid()).isEqualTo(file.uuid());
assertThat(fileReloaded.getUuidPath()).isEqualTo(file.getUuidPath());
assertThat(fileReloaded.branchUuid()).isEqualTo(file.branchUuid());
- assertThat(fileReloaded.getRootUuid()).isEqualTo(file.getRootUuid());
assertThat(fileReloaded.name()).isEqualTo(file.name());
assertThat(fileReloaded.path()).isEqualTo(file.path());
}
@@ -435,20 +426,18 @@ public class ReportPersistComponentsStepTest extends BaseStepTest {
assertExistButDisabled(removedDirectory.getKey(), removedFile.getKey());
// commit the functional transaction
- dbClient.componentDao().applyBChangesForRootComponentUuid(db.getSession(), project.uuid());
+ dbClient.componentDao().applyBChangesForBranchUuid(db.getSession(), project.uuid());
ComponentDto projectReloaded = dbClient.componentDao().selectByKey(db.getSession(), project.getKey()).get();
assertThat(projectReloaded.uuid()).isEqualTo(project.uuid());
assertThat(projectReloaded.getUuidPath()).isEqualTo(project.getUuidPath());
assertThat(projectReloaded.branchUuid()).isEqualTo(project.branchUuid());
- assertThat(projectReloaded.getRootUuid()).isEqualTo(project.getRootUuid());
assertThat(projectReloaded.isEnabled()).isTrue();
ComponentDto directoryReloaded = dbClient.componentDao().selectByKey(db.getSession(), "PROJECT_KEY:src/main/java/dir").get();
assertThat(directoryReloaded.uuid()).isEqualTo(removedDirectory.uuid());
assertThat(directoryReloaded.getUuidPath()).isEqualTo(removedDirectory.getUuidPath());
assertThat(directoryReloaded.branchUuid()).isEqualTo(removedDirectory.branchUuid());
- assertThat(directoryReloaded.getRootUuid()).isEqualTo(removedDirectory.getRootUuid());
assertThat(directoryReloaded.name()).isEqualTo(removedDirectory.name());
assertThat(directoryReloaded.longName()).isEqualTo(removedDirectory.longName());
assertThat(directoryReloaded.path()).isEqualTo(removedDirectory.path());
@@ -458,7 +447,6 @@ public class ReportPersistComponentsStepTest extends BaseStepTest {
assertThat(fileReloaded.uuid()).isEqualTo(removedFile.uuid());
assertThat(fileReloaded.getUuidPath()).isEqualTo(removedFile.getUuidPath());
assertThat(fileReloaded.branchUuid()).isEqualTo(removedFile.branchUuid());
- assertThat(fileReloaded.getRootUuid()).isEqualTo(removedFile.getRootUuid());
assertThat(fileReloaded.name()).isEqualTo(removedFile.name());
assertThat(fileReloaded.path()).isEqualTo(removedFile.path());
assertThat(fileReloaded.isEnabled()).isTrue();
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsPersistComponentsStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsPersistComponentsStepTest.java
index 60023e2e68c..5a8adb1a802 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsPersistComponentsStepTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsPersistComponentsStepTest.java
@@ -285,7 +285,7 @@ public class ViewsPersistComponentsStepTest extends BaseStepTest {
underTest.execute(new TestComputationStepContext());
// commit functional transaction -> copies B-fields to A-fields
- dbClient.componentDao().applyBChangesForRootComponentUuid(dbTester.getSession(), viewDto.uuid());
+ dbClient.componentDao().applyBChangesForBranchUuid(dbTester.getSession(), viewDto.uuid());
dbTester.commit();
assertRowsCountInTableProjects(1);
@@ -312,7 +312,7 @@ public class ViewsPersistComponentsStepTest extends BaseStepTest {
underTest.execute(new TestComputationStepContext());
// commit functional transaction -> copies B-fields to A-fields
- dbClient.componentDao().applyBChangesForRootComponentUuid(dbTester.getSession(), view.uuid());
+ dbClient.componentDao().applyBChangesForBranchUuid(dbTester.getSession(), view.uuid());
dbTester.commit();
assertRowsCountInTableProjects(3);
@@ -342,7 +342,7 @@ public class ViewsPersistComponentsStepTest extends BaseStepTest {
underTest.execute(new TestComputationStepContext());
// commit functional transaction -> copies B-fields to A-fields
- dbClient.componentDao().applyBChangesForRootComponentUuid(dbTester.getSession(), view.uuid());
+ dbClient.componentDao().applyBChangesForBranchUuid(dbTester.getSession(), view.uuid());
dbTester.commit();
ComponentDto pv1Dto = getComponentFromDb(PROJECT_VIEW_1_KEY);
@@ -365,7 +365,7 @@ public class ViewsPersistComponentsStepTest extends BaseStepTest {
underTest.execute(new TestComputationStepContext());
// commit functional transaction -> copies B-fields to A-fields
- dbClient.componentDao().applyBChangesForRootComponentUuid(dbTester.getSession(), view.uuid());
+ dbClient.componentDao().applyBChangesForBranchUuid(dbTester.getSession(), view.uuid());
dbTester.commit();
ComponentDto subViewReloaded = getComponentFromDb(SUBVIEW_1_KEY);
@@ -500,7 +500,6 @@ public class ViewsPersistComponentsStepTest extends BaseStepTest {
assertThat(dto.path()).isNull();
assertThat(dto.uuid()).isEqualTo(VIEW_UUID);
assertThat(dto.branchUuid()).isEqualTo(VIEW_UUID);
- assertThat(dto.getRootUuid()).isEqualTo(VIEW_UUID);
assertThat(dto.qualifier()).isEqualTo(Qualifiers.VIEW);
assertThat(dto.scope()).isEqualTo(Scopes.PROJECT);
assertThat(dto.getCopyComponentUuid()).isNull();
@@ -517,7 +516,6 @@ public class ViewsPersistComponentsStepTest extends BaseStepTest {
assertThat(dto.path()).isNull();
assertThat(dto.uuid()).isEqualTo(VIEW_UUID);
assertThat(dto.branchUuid()).isEqualTo(VIEW_UUID);
- assertThat(dto.getRootUuid()).isEqualTo(VIEW_UUID);
assertThat(dto.qualifier()).isEqualTo(Qualifiers.APP);
assertThat(dto.scope()).isEqualTo(Scopes.PROJECT);
assertThat(dto.getCopyComponentUuid()).isNull();
@@ -534,7 +532,6 @@ public class ViewsPersistComponentsStepTest extends BaseStepTest {
assertThat(sv1Dto.path()).isNull();
assertThat(sv1Dto.uuid()).isEqualTo(SUBVIEW_1_UUID);
assertThat(sv1Dto.branchUuid()).isEqualTo(viewDto.uuid());
- assertThat(sv1Dto.getRootUuid()).isEqualTo(viewDto.uuid());
assertThat(sv1Dto.qualifier()).isEqualTo(Qualifiers.SUBVIEW);
assertThat(sv1Dto.scope()).isEqualTo(Scopes.PROJECT);
assertThat(sv1Dto.getCopyComponentUuid()).isNull();
@@ -548,7 +545,6 @@ public class ViewsPersistComponentsStepTest extends BaseStepTest {
assertThat(pv1Dto.path()).isNull();
assertThat(pv1Dto.uuid()).isEqualTo(PROJECT_VIEW_1_UUID);
assertThat(pv1Dto.branchUuid()).isEqualTo(viewDto.uuid());
- assertThat(pv1Dto.getRootUuid()).isEqualTo(viewDto.uuid());
assertThat(pv1Dto.qualifier()).isEqualTo(Qualifiers.PROJECT);
assertThat(pv1Dto.scope()).isEqualTo(Scopes.FILE);
assertThat(pv1Dto.getCopyComponentUuid()).isEqualTo(project.uuid());
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/analysis/ExportAnalysesStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/analysis/ExportAnalysesStepTest.java
index 9d55733efa0..2c345e7db6d 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/analysis/ExportAnalysesStepTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/analysis/ExportAnalysesStepTest.java
@@ -66,7 +66,6 @@ public class ExportAnalysesStepTest {
.setEnabled(true)
.setUuid(PROJECT_UUID)
.setUuidPath(UUID_PATH_OF_ROOT)
- .setRootUuid(PROJECT_UUID)
.setBranchUuid(PROJECT_UUID);
private static final String DIR_UUID = "DIR_UUID";
@@ -81,7 +80,6 @@ public class ExportAnalysesStepTest {
.setEnabled(true)
.setUuid(DIR_UUID)
.setUuidPath(UUID_PATH)
- .setRootUuid(PROJECT_UUID)
.setBranchUuid(PROJECT_UUID);
private static final String FILE_UUID = "FILE_UUID";
@@ -93,7 +91,6 @@ public class ExportAnalysesStepTest {
.setName("The File")
.setUuid(FILE_UUID)
.setUuidPath(UUID_PATH + UUID_PATH_SEPARATOR + FILE_UUID)
- .setRootUuid(PROJECT_UUID)
.setEnabled(true)
.setBranchUuid(PROJECT_UUID);
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/branches/ExportBranchesStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/branches/ExportBranchesStepTest.java
index 6b30e38f8bc..9c8ae3124ac 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/branches/ExportBranchesStepTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/branches/ExportBranchesStepTest.java
@@ -63,7 +63,6 @@ public class ExportBranchesStepTest {
.setEnabled(true)
.setUuid(PROJECT_UUID)
.setUuidPath(UUID_PATH_OF_ROOT)
- .setRootUuid(PROJECT_UUID)
.setBranchUuid(PROJECT_UUID);
@Rule
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/component/ExportComponentsStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/component/ExportComponentsStepTest.java
index 2ffca9921e5..52bb309160c 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/component/ExportComponentsStepTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/component/ExportComponentsStepTest.java
@@ -58,7 +58,6 @@ public class ExportComponentsStepTest {
.setDescription("The project description")
.setEnabled(true)
.setUuid(PROJECT_UUID)
- .setRootUuid(PROJECT_UUID)
.setUuidPath(UUID_PATH_OF_ROOT)
.setCreatedAt(new Date(1596749115856L))
.setBranchUuid(PROJECT_UUID);
@@ -72,7 +71,6 @@ public class ExportComponentsStepTest {
.setKey("the_file")
.setName("The File")
.setUuid(FILE_UUID)
- .setRootUuid(PROJECT_UUID)
.setUuidPath(FILE_UUID_PATH)
.setEnabled(true)
.setCreatedAt(new Date(1596749148406L))
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/rule/ExportAdHocRulesStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/rule/ExportAdHocRulesStepTest.java
index 04e42d903a9..04d1f1f6ece 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/rule/ExportAdHocRulesStepTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/rule/ExportAdHocRulesStepTest.java
@@ -67,7 +67,6 @@ public class ExportAdHocRulesStepTest {
.setEnabled(true)
.setUuid(PROJECT_UUID)
.setUuidPath(UUID_PATH_OF_ROOT)
- .setRootUuid(PROJECT_UUID)
.setBranchUuid(PROJECT_UUID);
private static final List<BranchDto> BRANCHES = ImmutableList.of(
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/steps/ExportEventsStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/steps/ExportEventsStepTest.java
index ce2be44b06a..7dc28f6fb46 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/steps/ExportEventsStepTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/steps/ExportEventsStepTest.java
@@ -50,7 +50,6 @@ public class ExportEventsStepTest {
private static final ComponentDto PROJECT = new ComponentDto()
.setUuid(PROJECT_UUID)
.setUuidPath(UUID_PATH_OF_ROOT)
- .setRootUuid(PROJECT_UUID)
.setBranchUuid(PROJECT_UUID)
.setScope(Scopes.PROJECT)
.setQualifier(Qualifiers.PROJECT)
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/steps/ExportLinksStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/steps/ExportLinksStepTest.java
index 9ebb1558a65..4c0ddf07f65 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/steps/ExportLinksStepTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/steps/ExportLinksStepTest.java
@@ -54,7 +54,6 @@ public class ExportLinksStepTest {
.setDescription("The project description")
.setEnabled(true)
.setUuid(PROJECT_UUID)
- .setRootUuid(PROJECT_UUID)
.setUuidPath(UUID_PATH_OF_ROOT)
.setBranchUuid(PROJECT_UUID);
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/steps/ExportMeasuresStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/steps/ExportMeasuresStepTest.java
index 154b2a100f2..5ad64414c2c 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/steps/ExportMeasuresStepTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/steps/ExportMeasuresStepTest.java
@@ -51,21 +51,18 @@ public class ExportMeasuresStepTest {
private static final ComponentDto PROJECT = new ComponentDto()
.setKey("project_key")
.setUuid("project_uuid")
- .setRootUuid("project_uuid")
.setBranchUuid("project_uuid")
.setUuidPath(UUID_PATH_OF_ROOT)
.setEnabled(true);
private static final ComponentDto FILE = new ComponentDto()
.setKey("file_key")
.setUuid("file_uuid")
- .setRootUuid("project_uuid")
.setBranchUuid("project_uuid")
.setUuidPath(UUID_PATH_OF_ROOT + PROJECT.uuid() + UUID_PATH_SEPARATOR)
.setEnabled(true);
private static final ComponentDto ANOTHER_PROJECT = new ComponentDto()
.setKey("another_project_key")
.setUuid("another_project_uuid")
- .setRootUuid("another_project_uuid")
.setBranchUuid("another_project_uuid")
.setUuidPath(UUID_PATH_OF_ROOT)
.setEnabled(true);
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/steps/ExportNewCodePeriodsStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/steps/ExportNewCodePeriodsStepTest.java
index 0dc08af77a4..0540a66a417 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/steps/ExportNewCodePeriodsStepTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/steps/ExportNewCodePeriodsStepTest.java
@@ -53,7 +53,6 @@ public class ExportNewCodePeriodsStepTest {
private static final ComponentDto PROJECT = new ComponentDto()
.setUuid(PROJECT_UUID)
.setUuidPath(UUID_PATH_OF_ROOT)
- .setRootUuid(PROJECT_UUID)
.setBranchUuid(PROJECT_UUID)
.setQualifier(Qualifiers.PROJECT)
.setName("project")
@@ -61,7 +60,6 @@ public class ExportNewCodePeriodsStepTest {
private static final ComponentDto ANOTHER_PROJECT = new ComponentDto()
.setUuid(ANOTHER_PROJECT_UUID)
.setUuidPath(UUID_PATH_OF_ROOT)
- .setRootUuid(ANOTHER_PROJECT_UUID)
.setBranchUuid(ANOTHER_PROJECT_UUID)
.setQualifier(Qualifiers.PROJECT)
.setName("another_project")
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/steps/ExportSettingsStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/steps/ExportSettingsStepTest.java
index 946bc9c1af0..d895bb92537 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/steps/ExportSettingsStepTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectexport/steps/ExportSettingsStepTest.java
@@ -47,13 +47,11 @@ public class ExportSettingsStepTest {
private static final ComponentDto PROJECT = new ComponentDto()
.setUuid("project_uuid")
.setUuidPath(UUID_PATH_OF_ROOT)
- .setRootUuid("project_uuid")
.setBranchUuid("project_uuid")
.setKey("the_project");
private static final ComponentDto ANOTHER_PROJECT = new ComponentDto()
.setUuid("another_project_uuid")
.setUuidPath(UUID_PATH_OF_ROOT)
- .setRootUuid("another_project_uuid")
.setBranchUuid("another_project_uuid")
.setKey("another_project");
diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/queue/NextPendingTaskPickerTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/queue/NextPendingTaskPickerTest.java
index d66920eab76..3fd745c8ea0 100644
--- a/server/sonar-ce/src/test/java/org/sonar/ce/queue/NextPendingTaskPickerTest.java
+++ b/server/sonar-ce/src/test/java/org/sonar/ce/queue/NextPendingTaskPickerTest.java
@@ -364,7 +364,6 @@ public class NextPendingTaskPickerTest {
view.setKey(view_uuid + "_key");
view.setUuid(view_uuid);
view.setPrivate(false);
- view.setRootUuid(view_uuid);
view.setUuidPath("uuid_path");
view.setBranchUuid(view_uuid);
db.components().insertPortfolioAndSnapshot(view);
@@ -377,7 +376,6 @@ public class NextPendingTaskPickerTest {
branch.setKey(uuid + "_key");
branch.setUuid(uuid);
branch.setPrivate(false);
- branch.setRootUuid(uuid);
branch.setUuidPath("uuid_path");
branch.setBranchUuid(uuid);
db.components().insertComponent(branch);
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDao.java
index 419dabee042..9044d64ad57 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDao.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDao.java
@@ -348,22 +348,22 @@ public class ComponentDao implements Dao {
executeLargeUpdates(uuids, mapper(session)::updateBEnabledToFalse);
}
- public void applyBChangesForRootComponentUuid(DbSession session, String branchUuid) {
- mapper(session).applyBChangesForRootComponentUuid(branchUuid);
+ public void applyBChangesForBranchUuid(DbSession session, String branchUuid) {
+ mapper(session).applyBChangesForBranchUuid(branchUuid);
}
- public void resetBChangedForRootComponentUuid(DbSession session, String branchUuid) {
- mapper(session).resetBChangedForRootComponentUuid(branchUuid);
+ public void resetBChangedForBranchUuid(DbSession session, String branchUuid) {
+ mapper(session).resetBChangedForBranchUuid(branchUuid);
}
- public void setPrivateForRootComponentUuidWithoutAudit(DbSession session, String branchUuid, boolean isPrivate) {
- mapper(session).setPrivateForRootComponentUuid(branchUuid, isPrivate);
+ public void setPrivateForBranchUuidWithoutAudit(DbSession session, String branchUuid, boolean isPrivate) {
+ mapper(session).setPrivateForBranchUuid(branchUuid, isPrivate);
}
- public void setPrivateForRootComponentUuid(DbSession session, String branchUuid, boolean isPrivate, String qualifier, String componentKey, String componentName) {
+ public void setPrivateForBranchUuid(DbSession session, String branchUuid, boolean isPrivate, String qualifier, String componentKey, String componentName) {
ComponentNewValue componentNewValue = new ComponentNewValue(branchUuid, componentName, componentKey, isPrivate, qualifier);
auditPersister.updateComponentVisibility(session, componentNewValue);
- mapper(session).setPrivateForRootComponentUuid(branchUuid, isPrivate);
+ mapper(session).setPrivateForBranchUuid(branchUuid, isPrivate);
}
/*
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDto.java
index a9a8bd3b63f..64717fb4a5b 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDto.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDto.java
@@ -89,18 +89,6 @@ public class ComponentDto {
private String branchUuid;
/**
- * Badly named, it is not the root !
- * - on root: UUID="1" ROOT_UUID="1"
- * - on directory, value is the closest module: UUID="3" ROOT_UUID="2"
- * - on file, value is the closest module: UUID="4" ROOT_UUID="2"
- * - on view: UUID="5" ROOT_UUID="5"
- * - on sub-view: UUID="6" ROOT_UUID="5"
- *
- * @since 6.0
- */
- private String rootUuid;
-
- /**
* On non-main branches only, {@link #uuid} of the main branch that represents
* the project ({@link #qualifier}="TRK").
* It is propagated to all the components of the branch.
@@ -256,19 +244,6 @@ public class ComponentDto {
return this;
}
- /**
- * Use {@link #branchUuid()}
- */
- @Deprecated
- public String getRootUuid() {
- return rootUuid;
- }
-
- public ComponentDto setRootUuid(String rootUuid) {
- this.rootUuid = rootUuid;
- return this;
- }
-
@Nullable
public String getMainBranchProjectUuid() {
return mainBranchProjectUuid;
@@ -347,7 +322,6 @@ public class ComponentDto {
.append("scope", scope)
.append("qualifier", qualifier)
.append("branchUuid", branchUuid)
- .append("rootUuid", rootUuid)
.append("mainBranchProjectUuid", mainBranchProjectUuid)
.append("copyComponentUuid", copyComponentUuid)
.append("path", path)
@@ -365,7 +339,6 @@ public class ComponentDto {
copy.uuid = uuid;
copy.uuidPath = uuidPath;
copy.branchUuid = branchUuid;
- copy.rootUuid = rootUuid;
copy.mainBranchProjectUuid = mainBranchProjectUuid;
copy.copyComponentUuid = copyComponentUuid;
copy.scope = scope;
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentKeyUpdaterMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentKeyUpdaterMapper.java
index 7f1ab30ae27..21c0fc86233 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentKeyUpdaterMapper.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentKeyUpdaterMapper.java
@@ -28,7 +28,7 @@ public interface ComponentKeyUpdaterMapper {
ResourceDto selectComponentByUuid(@Param("uuid") String uuid);
- List<ResourceDto> selectBranchResources(@Param("rootUuid") String rootUuid);
+ List<ResourceDto> selectBranchResources(@Param("branchUuid") String branchUuid);
void updateComponent(ResourceDto resource);
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentMapper.java
index 3de18dbfde8..f9a9b632e94 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentMapper.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentMapper.java
@@ -109,11 +109,11 @@ public interface ComponentMapper {
void updateBEnabledToFalse(@Param("uuids") List<String> uuids);
- void applyBChangesForRootComponentUuid(@Param("branchUuid") String branchUuid);
+ void applyBChangesForBranchUuid(@Param("branchUuid") String branchUuid);
- void resetBChangedForRootComponentUuid(@Param("branchUuid") String branchUuid);
+ void resetBChangedForBranchUuid(@Param("branchUuid") String branchUuid);
- void setPrivateForRootComponentUuid(@Param("branchUuid") String branchUuid, @Param("isPrivate") boolean isPrivate);
+ void setPrivateForBranchUuid(@Param("branchUuid") String branchUuid, @Param("isPrivate") boolean isPrivate);
List<KeyWithUuidDto> selectComponentsFromPullRequestsTargetingCurrentBranchThatHaveOpenIssues(@Param("referenceBranchUuid") String referenceBranchUuid,
@Param("currentBranchUuid") String currentBranchUuid);
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ResourceDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ResourceDto.java
index 450f57712cb..368ea85447a 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ResourceDto.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ResourceDto.java
@@ -36,7 +36,6 @@ public class ResourceDto {
private String deprecatedKey;
private String name;
private String longName;
- private String rootUuid;
private String path;
private String scope;
private String qualifier;
@@ -91,15 +90,6 @@ public class ResourceDto {
return this;
}
- public String getRootUuid() {
- return rootUuid;
- }
-
- public ResourceDto setRootUuid(String rootUuid) {
- this.rootUuid = rootUuid;
- return this;
- }
-
public String getPath() {
return path;
}
diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentKeyUpdaterMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentKeyUpdaterMapper.xml
index e004a66d79a..a7a4d1a85c4 100644
--- a/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentKeyUpdaterMapper.xml
+++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentKeyUpdaterMapper.xml
@@ -7,7 +7,6 @@
<result property="key" column="kee"/>
<result property="uuid" column="uuid"/>
<result property="deprecatedKey" column="deprecated_kee"/>
- <result property="rootUuid" column="root_uuid"/>
<result property="scope" column="scope"/>
<result property="enabled" column="enabled"/>
</resultMap>
@@ -26,7 +25,7 @@
<select id="selectBranchResources" parameterType="String" resultMap="resourceResultMap">
select * from components
where
- root_uuid = #{rootUuid,jdbcType=VARCHAR}
+ branch_uuid = #{branchUuid,jdbcType=VARCHAR}
and scope != 'PRJ'
</select>
diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentMapper.xml
index 22b2c021e1e..996adb5462a 100644
--- a/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentMapper.xml
+++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentMapper.xml
@@ -14,7 +14,6 @@
p.qualifier as qualifier,
p.scope as scope,
p.language as language,
- p.root_uuid as rootUuid,
p.path as path,
p.enabled as enabled,
p.copy_component_uuid as copyComponentUuid,
@@ -72,7 +71,6 @@
p.qualifier as qualifier,
p.scope as scope,
p.language as language,
- p.root_uuid as rootUuid,
p.path as path,
p.enabled as enabled,
p.copy_component_uuid as copyComponentUuid,
@@ -162,7 +160,7 @@
<include refid="componentColumns"/>
FROM components p
INNER JOIN components child ON
- child.root_uuid=p.uuid
+ child.branch_uuid=p.uuid
and child.enabled=${_true}
where
p.enabled=${_true}
@@ -540,7 +538,6 @@
language,
description,
private,
- root_uuid,
path,
copy_component_uuid,
enabled,
@@ -569,7 +566,6 @@
#{language,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR},
#{isPrivate,jdbcType=BOOLEAN},
- #{rootUuid,jdbcType=VARCHAR},
#{path,jdbcType=VARCHAR},
#{copyComponentUuid,jdbcType=VARCHAR},
#{enabled,jdbcType=BOOLEAN},
@@ -623,7 +619,7 @@
uuid in <foreach collection="uuids" open="(" close=")" item="uuid" separator=",">#{uuid,jdbcType=VARCHAR}</foreach>
</update>
- <update id="applyBChangesForRootComponentUuid" parameterType="string" useGeneratedKeys="false">
+ <update id="applyBChangesForBranchUuid" parameterType="string" useGeneratedKeys="false">
update components set
<!-- Component key is normally immutable, but since 7.6 deprecated_kee is used as a b_kee to migrate component keys after the drop of modules -->
kee = deprecated_kee,
@@ -665,7 +661,7 @@
b_changed = ${_true}
</update>
- <update id="resetBChangedForRootComponentUuid" parameterType="map" >
+ <update id="resetBChangedForBranchUuid" parameterType="map" >
update components
set b_changed = ${_false},
<!-- Component key is normally immutable, but since 7.6 deprecated_kee is used as a b_kee to migrate component keys after the drop of modules -->
@@ -675,7 +671,7 @@
b_changed = ${_true}
</update>
- <update id="setPrivateForRootComponentUuid" parameterType="map" >
+ <update id="setPrivateForBranchUuid" parameterType="map" >
update components set
private = #{isPrivate,jdbcType=BOOLEAN}
where
diff --git a/server/sonar-db-dao/src/schema/schema-sq.ddl b/server/sonar-db-dao/src/schema/schema-sq.ddl
index cbafbb3785b..ad8bc63ac84 100644
--- a/server/sonar-db-dao/src/schema/schema-sq.ddl
+++ b/server/sonar-db-dao/src/schema/schema-sq.ddl
@@ -211,7 +211,6 @@ CREATE TABLE "COMPONENTS"(
"SCOPE" CHARACTER VARYING(3),
"QUALIFIER" CHARACTER VARYING(10),
"PRIVATE" BOOLEAN NOT NULL,
- "ROOT_UUID" CHARACTER VARYING(50) NOT NULL,
"LANGUAGE" CHARACTER VARYING(20),
"COPY_COMPONENT_UUID" CHARACTER VARYING(50),
"PATH" CHARACTER VARYING(2000),
@@ -231,7 +230,6 @@ CREATE TABLE "COMPONENTS"(
"CREATED_AT" TIMESTAMP
);
CREATE INDEX "PROJECTS_QUALIFIER" ON "COMPONENTS"("QUALIFIER" NULLS FIRST);
-CREATE INDEX "PROJECTS_ROOT_UUID" ON "COMPONENTS"("ROOT_UUID" NULLS FIRST);
CREATE INDEX "IDX_MAIN_BRANCH_PRJ_UUID" ON "COMPONENTS"("MAIN_BRANCH_PROJECT_UUID" NULLS FIRST);
CREATE UNIQUE INDEX "COMPONENTS_UUID" ON "COMPONENTS"("UUID" NULLS FIRST);
CREATE INDEX "COMPONENTS_BRANCH_UUID" ON "COMPONENTS"("BRANCH_UUID" NULLS FIRST);
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java
index f7f739e8820..de315a06e37 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java
@@ -272,7 +272,6 @@ public class ComponentDaoTest {
assertThat(result.getKey()).isEqualTo(project.getKey());
assertThat(result.uuid()).isEqualTo(project.uuid());
assertThat(result.getUuidPath()).isEqualTo(project.getUuidPath());
- assertThat(result.getRootUuid()).isEqualTo(project.uuid());
assertThat(result.branchUuid()).isEqualTo(project.uuid());
}
@@ -1640,7 +1639,7 @@ public class ComponentDaoTest {
}
@Test
- public void setPrivateForRootComponentUuid_updates_private_column_to_specified_value_for_all_rows_with_specified_projectUuid() {
+ public void setPrivateForBranchUuid_updates_private_column_to_specified_value_for_all_rows_with_specified_projectUuid() {
String uuid1 = "uuid1";
String uuid2 = "uuid2";
@@ -1649,10 +1648,10 @@ public class ComponentDaoTest {
db.components().insertComponent(newPrivateProjectDto().setBranchUuid(uuid1).setPrivate(false)).uuid(),
db.components().insertComponent(newPrivateProjectDto().setBranchUuid(uuid2).setPrivate(true)).uuid(),
db.components().insertComponent(newPrivateProjectDto().setBranchUuid(uuid2).setPrivate(false)).uuid(),
- db.components().insertComponent(newPrivateProjectDto().setRootUuid(uuid1).setBranchUuid("foo").setPrivate(false)).uuid(),
+ db.components().insertComponent(newPrivateProjectDto().setBranchUuid("foo").setPrivate(false)).uuid(),
};
- underTest.setPrivateForRootComponentUuidWithoutAudit(db.getSession(), uuid1, true);
+ underTest.setPrivateForBranchUuidWithoutAudit(db.getSession(), uuid1, true);
assertThat(privateFlagOfUuid(uuids[0])).isTrue();
assertThat(privateFlagOfUuid(uuids[1])).isTrue();
@@ -1660,7 +1659,7 @@ public class ComponentDaoTest {
assertThat(privateFlagOfUuid(uuids[3])).isFalse();
assertThat(privateFlagOfUuid(uuids[4])).isFalse();
- underTest.setPrivateForRootComponentUuidWithoutAudit(db.getSession(), uuid1, false);
+ underTest.setPrivateForBranchUuidWithoutAudit(db.getSession(), uuid1, false);
assertThat(privateFlagOfUuid(uuids[0])).isFalse();
assertThat(privateFlagOfUuid(uuids[1])).isFalse();
@@ -1668,7 +1667,7 @@ public class ComponentDaoTest {
assertThat(privateFlagOfUuid(uuids[3])).isFalse();
assertThat(privateFlagOfUuid(uuids[4])).isFalse();
- underTest.setPrivateForRootComponentUuidWithoutAudit(db.getSession(), uuid2, false);
+ underTest.setPrivateForBranchUuidWithoutAudit(db.getSession(), uuid2, false);
assertThat(privateFlagOfUuid(uuids[0])).isFalse();
assertThat(privateFlagOfUuid(uuids[1])).isFalse();
@@ -1676,7 +1675,7 @@ public class ComponentDaoTest {
assertThat(privateFlagOfUuid(uuids[3])).isFalse();
assertThat(privateFlagOfUuid(uuids[4])).isFalse();
- underTest.setPrivateForRootComponentUuidWithoutAudit(db.getSession(), uuid2, true);
+ underTest.setPrivateForBranchUuidWithoutAudit(db.getSession(), uuid2, true);
assertThat(privateFlagOfUuid(uuids[0])).isFalse();
assertThat(privateFlagOfUuid(uuids[1])).isFalse();
@@ -1763,15 +1762,15 @@ public class ComponentDaoTest {
}
@Test
- public void setPrivateForRootComponentUuid_auditPersisterIsCalled() {
- underTestWithAuditPersister.setPrivateForRootComponentUuid(dbSession, "anyUuid", false, "key", APP, "appName");
+ public void setPrivateForBranchUuid_auditPersisterIsCalled() {
+ underTestWithAuditPersister.setPrivateForBranchUuid(dbSession, "anyUuid", false, "key", APP, "appName");
verify(auditPersister).updateComponentVisibility(any(DbSession.class), any(ComponentNewValue.class));
}
@Test
- public void setPrivateForRootComponentUuidWithoutAudit_auditPersisterIsNotCalled() {
- underTestWithAuditPersister.setPrivateForRootComponentUuidWithoutAudit(dbSession, "anyUuid", false);
+ public void setPrivateForBranchUuidWithoutAudit_auditPersisterIsNotCalled() {
+ underTestWithAuditPersister.setPrivateForBranchUuidWithoutAudit(dbSession, "anyUuid", false);
verifyNoInteractions(auditPersister);
}
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDtoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDtoTest.java
index 102931506c7..e571ddcbc0f 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDtoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDtoTest.java
@@ -37,8 +37,7 @@ public class ComponentDtoTest {
.setLanguage("java")
.setDescription("desc")
.setPath("src/org/struts/RequestContext.java")
- .setCopyComponentUuid("uuid_5")
- .setRootUuid("uuid_3");
+ .setCopyComponentUuid("uuid_5");
assertThat(componentDto.getKey()).isEqualTo("org.struts:struts-core:src/org/struts/RequestContext.java");
assertThat(componentDto.name()).isEqualTo("RequestContext.java");
@@ -48,7 +47,6 @@ public class ComponentDtoTest {
assertThat(componentDto.path()).isEqualTo("src/org/struts/RequestContext.java");
assertThat(componentDto.language()).isEqualTo("java");
assertThat(componentDto.description()).isEqualTo("desc");
- assertThat(componentDto.getRootUuid()).isEqualTo("uuid_3");
assertThat(componentDto.getCopyComponentUuid()).isEqualTo("uuid_5");
assertThat(componentDto.isPrivate()).isFalse();
}
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentKeyUpdaterDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentKeyUpdaterDaoTest.java
index a1c28e8dc87..5e2282d61ec 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentKeyUpdaterDaoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentKeyUpdaterDaoTest.java
@@ -184,7 +184,7 @@ public class ComponentKeyUpdaterDaoTest {
}
private void populateSomeData() {
- ComponentDto project1 = db.components().insertPrivateProject(t -> t.setKey("org.struts:struts").setUuid("A"));
+ ComponentDto project1 = db.components().insertPrivateProject(t -> t.setKey("org.struts:struts").setUuid("A").setBranchUuid("A"));
ComponentDto directory1 = db.components().insertComponent(newDirectory(project1, "/src/org/struts").setUuid("B"));
db.components().insertComponent(ComponentTesting.newFileDto(project1, directory1).setKey("org.struts:struts:/src/org/struts/RequestContext.java").setUuid("C"));
ComponentDto project2 = db.components().insertPublicProject(t -> t.setKey("foo:struts-core").setUuid("D"));
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date-result.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date-result.xml
index 1c3e6e59276..637ab8ecaf9 100644
--- a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date-result.xml
+++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date-result.xml
@@ -2,12 +2,9 @@
<projects organization_uuid="org1"
id="1"
- root_uuid="uuid_200"
uuid="ABCD"
uuid_path="NOT_USED"
project_uuid="ABCD"
- module_uuid="[null]"
- module_uuid_path="."
main_branch_project_uuid="[null]"
scope="PRJ"
qualifier="TRK"
@@ -32,8 +29,6 @@
b_uuid_path="[null]"
b_language="[null]"
b_long_name="[null]"
- b_module_uuid="[null]"
- b_module_uuid_path="[null]"
b_name="[null]"
b_path="[null]"
b_qualifier="[null]"
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date.xml
index 1c3e6e59276..637ab8ecaf9 100644
--- a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date.xml
+++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date.xml
@@ -2,12 +2,9 @@
<projects organization_uuid="org1"
id="1"
- root_uuid="uuid_200"
uuid="ABCD"
uuid_path="NOT_USED"
project_uuid="ABCD"
- module_uuid="[null]"
- module_uuid_path="."
main_branch_project_uuid="[null]"
scope="PRJ"
qualifier="TRK"
@@ -32,8 +29,6 @@
b_uuid_path="[null]"
b_language="[null]"
b_long_name="[null]"
- b_module_uuid="[null]"
- b_module_uuid_path="[null]"
b_name="[null]"
b_path="[null]"
b_qualifier="[null]"
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/issue/IssueDaoTest/shared.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/issue/IssueDaoTest/shared.xml
index 32a278ac094..583ec53880b 100644
--- a/server/sonar-db-dao/src/test/resources/org/sonar/db/issue/IssueDaoTest/shared.xml
+++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/issue/IssueDaoTest/shared.xml
@@ -9,10 +9,7 @@
<projects organization_uuid="org1"
uuid="ABCD"
uuid_path="NOT_USED"
- root_uuid="ABCD"
project_uuid="ABCD"
- module_uuid="[null]"
- module_uuid_path="."
kee="struts"
qualifier="TRK"
scope="PRJ"
@@ -20,10 +17,7 @@
<projects organization_uuid="org1"
uuid="BCDE"
uuid_path="NOT_USED"
- root_uuid="ABCD"
project_uuid="ABCD"
- module_uuid="[null]"
- module_uuid_path=".ABCD."
kee="struts-core"
qualifier="BRC"
scope="PRJ"
@@ -31,10 +25,7 @@
<projects organization_uuid="org1"
uuid="CDEF"
uuid_path="NOT_USED"
- root_uuid="BCDE"
project_uuid="ABCD"
- module_uuid="BCDE"
- module_uuid_path=".ABCD.BCDE."
kee="Action.java"
qualifier="CLA"
scope="PRJ"
@@ -42,10 +33,7 @@
<projects organization_uuid="org1"
uuid="DEFG"
uuid_path="NOT_USED"
- root_uuid="CDEF"
project_uuid="ABCD"
- module_uuid="BCDE"
- module_uuid_path=".ABCD.BCDE."
kee="Filter.java"
qualifier="CLA"
scope="PRJ"
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/measure/MeasureDaoTest/past_measures.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/measure/MeasureDaoTest/past_measures.xml
index f1640d1d48e..35a3f8823da 100644
--- a/server/sonar-db-dao/src/test/resources/org/sonar/db/measure/MeasureDaoTest/past_measures.xml
+++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/measure/MeasureDaoTest/past_measures.xml
@@ -43,48 +43,39 @@
uuid="ABCD"
uuid_path="NOT_USED"
project_uuid="ABCD"
- module_uuid="[null]"
- module_uuid_path=".ABCD."
enabled="[true]"
long_name="[null]"
id="1"
scope="PRJ"
qualifier="TRK"
kee="project"
- name="project"
- root_uuid="ABCD"/>
+ name="project"/>
<!-- package -->
<projects organization_uuid="org1"
uuid="BCDE"
uuid_path="NOT_USED"
project_uuid="ABCD"
- module_uuid="ABCD"
- module_uuid_path=".ABCD."
enabled="[true]"
long_name="[null]"
id="2"
scope="DIR"
qualifier="PAC"
kee="project:org.foo"
- name="org.foo"
- root_uuid="ABCD"/>
+ name="org.foo"/>
<!-- file -->
<projects organization_uuid="org1"
uuid="CDEF"
uuid_path="NOT_USED"
project_uuid="ABCD"
- module_uuid="ABCD"
- module_uuid_path=".ABCD."
enabled="[true]"
long_name="org.foo.Bar"
id="3"
scope="FIL"
qualifier="CLA"
kee="project:org.foo.Bar"
- name="Bar"
- root_uuid="ABCD"/>
+ name="Bar"/>
<!-- snapshots -->
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/measure/MeasureDaoTest/select_by_snapshot_and_metric_keys.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/measure/MeasureDaoTest/select_by_snapshot_and_metric_keys.xml
index 2c00644180f..81544d11094 100644
--- a/server/sonar-db-dao/src/test/resources/org/sonar/db/measure/MeasureDaoTest/select_by_snapshot_and_metric_keys.xml
+++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/measure/MeasureDaoTest/select_by_snapshot_and_metric_keys.xml
@@ -10,7 +10,6 @@
<projects organization_uuid="org1"
uuid="FILE1"
uuid_path="NOT_USED"
- root_uuid="ABCD"
id="1"
kee="org.struts:struts-core:src/org/struts/RequestContext.java"
enabled="[true]"/>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/measure/MeasureDaoTest/shared.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/measure/MeasureDaoTest/shared.xml
index 3ef039a19d8..2255cf96ee2 100644
--- a/server/sonar-db-dao/src/test/resources/org/sonar/db/measure/MeasureDaoTest/shared.xml
+++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/measure/MeasureDaoTest/shared.xml
@@ -10,7 +10,6 @@
<projects organization_uuid="org1"
uuid="ABCD"
uuid_path="NOT_USED"
- root_uuid="ABCD"
id="1"
kee="org.struts:struts-core:src/org/struts/RequestContext.java"
enabled="[true]"/>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/should_return_root_project_keys_for_anonymous.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/should_return_root_project_keys_for_anonymous.xml
index 811a4ec4fe3..64b5561d605 100644
--- a/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/should_return_root_project_keys_for_anonymous.xml
+++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/should_return_root_project_keys_for_anonymous.xml
@@ -17,9 +17,7 @@
id="300"
uuid="ABCD"
uuid_path="NOT_USED"
- root_uuid="ABCD"
project_uuid="ABCD"
- module_uuid="[null]"
kee="pj-w-snapshot"
scope="PRJ"
qualifier="TRK"
@@ -29,9 +27,7 @@
id="301"
uuid="BCDE"
uuid_path="NOT_USED"
- root_uuid="BCDE"
project_uuid="BCDE"
- module_uuid="[null]"
kee="pj-w-snapshot1"
scope="PRJ"
qualifier="TRK"
@@ -41,9 +37,7 @@
id="302"
uuid="CDEF"
uuid_path="NOT_USED"
- root_uuid="CDEF"
project_uuid="CDEF"
- module_uuid="[null]"
kee="pj-w-snapshot2"
scope="PRJ"
qualifier="TRK"
@@ -54,9 +48,7 @@
id="303"
uuid="DEFG"
uuid_path="NOT_USED"
- root_uuid="DEFG"
project_uuid="DEFG"
- module_uuid="[null]"
kee="pj-w-snapshot3"
scope="PRJ"
qualifier="TRK"
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/should_return_root_project_keys_for_group.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/should_return_root_project_keys_for_group.xml
index 92784c88940..4a73fb1ea28 100644
--- a/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/should_return_root_project_keys_for_group.xml
+++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/should_return_root_project_keys_for_group.xml
@@ -19,9 +19,7 @@
id="300"
uuid="ABCD"
uuid_path="NOT_USED"
- root_uuid="ABCD"
project_uuid="ABCD"
- module_uuid="[null]"
kee="pj-w-snapshot"
scope="PRJ"
qualifier="TRK"
@@ -31,9 +29,7 @@
id="301"
uuid="BCDE"
uuid_path="NOT_USED"
- root_uuid="BCDE"
project_uuid="BCDE"
- module_uuid="[null]"
kee="pj-w-snapshot1"
scope="PRJ"
qualifier="TRK"
@@ -43,9 +39,7 @@
id="302"
uuid="CDEF"
uuid_path="NOT_USED"
- root_uuid="CDEF"
project_uuid="CDEF"
- module_uuid="[null]"
kee="pj-w-snapshot2"
scope="PRJ"
qualifier="TRK"
@@ -56,9 +50,7 @@
id="303"
uuid="DEFG"
uuid_path="NOT_USED"
- root_uuid="DEFG"
project_uuid="DEFG"
- module_uuid="[null]"
kee="pj-w-snapshot3"
scope="PRJ"
qualifier="TRK"
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/should_return_root_project_keys_for_user.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/should_return_root_project_keys_for_user.xml
index 58270a7655b..31404170f71 100644
--- a/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/should_return_root_project_keys_for_user.xml
+++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/should_return_root_project_keys_for_user.xml
@@ -18,9 +18,7 @@
id="300"
uuid="ABCD"
uuid_path="NOT_USED"
- root_uuid="ABCD"
project_uuid="ABCD"
- module_uuid="[null]"
kee="pj-w-snapshot"
scope="PRJ"
qualifier="TRK"
@@ -30,9 +28,7 @@
id="301"
uuid="BCDE"
uuid_path="NOT_USED"
- root_uuid="BCDE"
project_uuid="BCDE"
- module_uuid="[null]"
kee="pj-w-snapshot1"
scope="PRJ"
qualifier="TRK"
@@ -42,9 +38,7 @@
id="302"
uuid="CDEF"
uuid_path="NOT_USED"
- root_uuid="CDEF"
project_uuid="CDEF"
- module_uuid="[null]"
kee="pj-w-snapshot2"
scope="PRJ"
qualifier="TRK"
@@ -55,9 +49,7 @@
id="303"
uuid="DEFG"
uuid_path="NOT_USED"
- root_uuid="DEFG"
project_uuid="DEFG"
- module_uuid="[null]"
kee="pj-w-snapshot3"
scope="PRJ"
qualifier="TRK"
diff --git a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/component/ComponentTesting.java b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/component/ComponentTesting.java
index 65f91d21f70..37631297384 100644
--- a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/component/ComponentTesting.java
+++ b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/component/ComponentTesting.java
@@ -51,6 +51,7 @@ public class ComponentTesting {
.setName(filename)
.setLongName(path)
.setScope(Scopes.FILE)
+ .setBranchUuid(project.branchUuid())
.setQualifier(Qualifiers.FILE)
.setPath(path)
.setCreatedAt(new Date())
@@ -67,6 +68,7 @@ public class ComponentTesting {
.setKey(key)
.setName(path)
.setLongName(path)
+ .setBranchUuid(project.branchUuid())
.setPath(path)
.setScope(Scopes.DIRECTORY)
.setQualifier(Qualifiers.DIRECTORY);
@@ -108,7 +110,6 @@ public class ComponentTesting {
.setUuid(uuid)
.setUuidPath(UUID_PATH_OF_ROOT)
.setBranchUuid(uuid)
- .setRootUuid(uuid)
.setKey("KEY_" + uuid)
.setName("NAME_" + uuid)
.setLongName("LONG_NAME_" + uuid)
@@ -174,7 +175,6 @@ public class ComponentTesting {
.setUuidPath(formatUuidPathFromParent(parent))
.setKey(uuid)
.setBranchUuid(project.branchUuid())
- .setRootUuid(project.uuid())
.setMainBranchProjectUuid(project.getMainBranchProjectUuid())
.setCreatedAt(new Date())
.setEnabled(true)
@@ -213,7 +213,6 @@ public class ComponentTesting {
.setUuid(uuid)
.setUuidPath(UUID_PATH_OF_ROOT)
.setBranchUuid(uuid)
- .setRootUuid(uuid)
.setKey(project.getKey())
.setMainBranchProjectUuid(project.getUuid())
.setName(project.getName())
@@ -235,7 +234,6 @@ public class ComponentTesting {
.setUuid(uuid)
.setUuidPath(UUID_PATH_OF_ROOT)
.setBranchUuid(uuid)
- .setRootUuid(uuid)
.setKey(project.getKey())
.setMainBranchProjectUuid(project.uuid())
.setName(project.name())
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v100/DbVersion100.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v100/DbVersion100.java
index e5c07c0a073..727d281b2b9 100644
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v100/DbVersion100.java
+++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v100/DbVersion100.java
@@ -47,6 +47,10 @@ public class DbVersion100 implements DbVersion {
.add(10_0_003, "Drop column 'module_uuid_path' in the 'Components' table", DropModuleUuidPathInComponents.class)
.add(10_0_004, "Drop column 'b_module_uuid' in the 'Components' table", DropBModuleUuidInComponents.class)
.add(10_0_005, "Drop column 'b_module_uuid_path' in the 'Components' table", DropBModuleUuidPathInComponents.class)
+ .add(10_0_006, "Drop index 'projects_root_uuid' in the 'Components' table", DropIndexProjectsRootUuidInComponents.class)
+ .add(10_0_007, "Drop column 'root_uuid' in the 'Components' table", DropRootUuidInComponents.class)
+
+
;
}
}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v100/DropIndexProjectsRootUuidInComponents.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v100/DropIndexProjectsRootUuidInComponents.java
new file mode 100644
index 00000000000..8d4570d7977
--- /dev/null
+++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v100/DropIndexProjectsRootUuidInComponents.java
@@ -0,0 +1,32 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2023 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.server.platform.db.migration.version.v100;
+
+import org.sonar.db.Database;
+import org.sonar.server.platform.db.migration.step.DropIndexChange;
+
+public class DropIndexProjectsRootUuidInComponents extends DropIndexChange {
+ private static final String INDEX_NAME = "projects_root_uuid";
+ private static final String TABLE_NAME = "components";
+
+ public DropIndexProjectsRootUuidInComponents(Database db) {
+ super(db, INDEX_NAME, TABLE_NAME);
+ }
+}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v100/DropRootUuidInComponents.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v100/DropRootUuidInComponents.java
new file mode 100644
index 00000000000..b8f583bb8b7
--- /dev/null
+++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v100/DropRootUuidInComponents.java
@@ -0,0 +1,32 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2023 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.server.platform.db.migration.version.v100;
+
+import org.sonar.db.Database;
+import org.sonar.server.platform.db.migration.step.DropColumnChange;
+
+public class DropRootUuidInComponents extends DropColumnChange {
+ private static final String COLUMN_NAME = "root_uuid";
+ private static final String TABLE_NAME = "components";
+
+ protected DropRootUuidInComponents(Database db) {
+ super(db, TABLE_NAME, COLUMN_NAME);
+ }
+}
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropIndexProjectsRootUuidInComponentsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropIndexProjectsRootUuidInComponentsTest.java
new file mode 100644
index 00000000000..86029dae481
--- /dev/null
+++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropIndexProjectsRootUuidInComponentsTest.java
@@ -0,0 +1,51 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2023 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.server.platform.db.migration.version.v100;
+
+import java.sql.SQLException;
+import org.junit.Rule;
+import org.junit.Test;
+import org.sonar.db.CoreDbTester;
+import org.sonar.server.platform.db.migration.step.DdlChange;
+
+public class DropIndexProjectsRootUuidInComponentsTest {
+ private static final String TABLE_NAME = "components";
+ private static final String COLUMN_NAME = "root_uuid";
+ private static final String INDEX_NAME = "projects_root_uuid";
+
+ @Rule
+ public final CoreDbTester db = CoreDbTester.createForSchema(DropIndexProjectsRootUuidInComponentsTest.class, "schema.sql");
+ private final DdlChange underTest = new DropIndexProjectsRootUuidInComponents(db.database());
+
+ @Test
+ public void drops_index() throws SQLException {
+ db.assertIndex(TABLE_NAME, INDEX_NAME, COLUMN_NAME);
+ underTest.execute();
+ db.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME);
+ }
+
+ @Test
+ public void migration_is_reentrant() throws SQLException {
+ db.assertIndex(TABLE_NAME, INDEX_NAME, COLUMN_NAME);
+ underTest.execute();
+ underTest.execute();
+ db.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME);
+ }
+}
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropRootUuidInComponentsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropRootUuidInComponentsTest.java
new file mode 100644
index 00000000000..0206bc8da58
--- /dev/null
+++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropRootUuidInComponentsTest.java
@@ -0,0 +1,51 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2023 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.server.platform.db.migration.version.v100;
+
+import java.sql.SQLException;
+import java.sql.Types;
+import org.junit.Rule;
+import org.junit.Test;
+import org.sonar.db.CoreDbTester;
+import org.sonar.server.platform.db.migration.step.DdlChange;
+
+public class DropRootUuidInComponentsTest {
+ private static final String TABLE_NAME = "components";
+ private static final String COLUMN_NAME = "root_uuid";
+
+ @Rule
+ public final CoreDbTester db = CoreDbTester.createForSchema(DropRootUuidInComponentsTest.class, "schema.sql");
+ private final DdlChange underTest = new DropRootUuidInComponents(db.database());
+
+ @Test
+ public void drops_column() throws SQLException {
+ db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, 50, false);
+ underTest.execute();
+ db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
+ }
+
+ @Test
+ public void migration_is_reentrant() throws SQLException {
+ db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, 50, false);
+ underTest.execute();
+ underTest.execute();
+ db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
+ }
+}
diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropIndexProjectsRootUuidInComponentsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropIndexProjectsRootUuidInComponentsTest/schema.sql
new file mode 100644
index 00000000000..00a2b7864ae
--- /dev/null
+++ b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropIndexProjectsRootUuidInComponentsTest/schema.sql
@@ -0,0 +1,37 @@
+
+CREATE TABLE "COMPONENTS"(
+ "UUID" CHARACTER VARYING(50) NOT NULL,
+ "KEE" CHARACTER VARYING(1000),
+ "DEPRECATED_KEE" CHARACTER VARYING(400),
+ "NAME" CHARACTER VARYING(2000),
+ "LONG_NAME" CHARACTER VARYING(2000),
+ "DESCRIPTION" CHARACTER VARYING(2000),
+ "ENABLED" BOOLEAN DEFAULT TRUE NOT NULL,
+ "SCOPE" CHARACTER VARYING(3),
+ "QUALIFIER" CHARACTER VARYING(10),
+ "PRIVATE" BOOLEAN NOT NULL,
+ "ROOT_UUID" CHARACTER VARYING(50) NOT NULL,
+ "LANGUAGE" CHARACTER VARYING(20),
+ "COPY_COMPONENT_UUID" CHARACTER VARYING(50),
+ "PATH" CHARACTER VARYING(2000),
+ "UUID_PATH" CHARACTER VARYING(1500) NOT NULL,
+ "BRANCH_UUID" CHARACTER VARYING(50) NOT NULL,
+ "MAIN_BRANCH_PROJECT_UUID" CHARACTER VARYING(50),
+ "B_CHANGED" BOOLEAN,
+ "B_NAME" CHARACTER VARYING(500),
+ "B_LONG_NAME" CHARACTER VARYING(500),
+ "B_DESCRIPTION" CHARACTER VARYING(2000),
+ "B_ENABLED" BOOLEAN,
+ "B_QUALIFIER" CHARACTER VARYING(10),
+ "B_LANGUAGE" CHARACTER VARYING(20),
+ "B_COPY_COMPONENT_UUID" CHARACTER VARYING(50),
+ "B_PATH" CHARACTER VARYING(2000),
+ "B_UUID_PATH" CHARACTER VARYING(1500),
+ "CREATED_AT" TIMESTAMP
+);
+CREATE INDEX "PROJECTS_QUALIFIER" ON "COMPONENTS"("QUALIFIER" NULLS FIRST);
+CREATE INDEX "PROJECTS_ROOT_UUID" ON "COMPONENTS"("ROOT_UUID" NULLS FIRST);
+CREATE INDEX "IDX_MAIN_BRANCH_PRJ_UUID" ON "COMPONENTS"("MAIN_BRANCH_PROJECT_UUID" NULLS FIRST);
+CREATE UNIQUE INDEX "COMPONENTS_UUID" ON "COMPONENTS"("UUID" NULLS FIRST);
+CREATE INDEX "COMPONENTS_BRANCH_UUID" ON "COMPONENTS"("BRANCH_UUID" NULLS FIRST);
+CREATE UNIQUE INDEX "COMPONENTS_KEE_BRANCH_UUID" ON "COMPONENTS"("KEE" NULLS FIRST, "BRANCH_UUID" NULLS FIRST);
diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropRootUuidInComponentsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropRootUuidInComponentsTest/schema.sql
new file mode 100644
index 00000000000..00a2b7864ae
--- /dev/null
+++ b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropRootUuidInComponentsTest/schema.sql
@@ -0,0 +1,37 @@
+
+CREATE TABLE "COMPONENTS"(
+ "UUID" CHARACTER VARYING(50) NOT NULL,
+ "KEE" CHARACTER VARYING(1000),
+ "DEPRECATED_KEE" CHARACTER VARYING(400),
+ "NAME" CHARACTER VARYING(2000),
+ "LONG_NAME" CHARACTER VARYING(2000),
+ "DESCRIPTION" CHARACTER VARYING(2000),
+ "ENABLED" BOOLEAN DEFAULT TRUE NOT NULL,
+ "SCOPE" CHARACTER VARYING(3),
+ "QUALIFIER" CHARACTER VARYING(10),
+ "PRIVATE" BOOLEAN NOT NULL,
+ "ROOT_UUID" CHARACTER VARYING(50) NOT NULL,
+ "LANGUAGE" CHARACTER VARYING(20),
+ "COPY_COMPONENT_UUID" CHARACTER VARYING(50),
+ "PATH" CHARACTER VARYING(2000),
+ "UUID_PATH" CHARACTER VARYING(1500) NOT NULL,
+ "BRANCH_UUID" CHARACTER VARYING(50) NOT NULL,
+ "MAIN_BRANCH_PROJECT_UUID" CHARACTER VARYING(50),
+ "B_CHANGED" BOOLEAN,
+ "B_NAME" CHARACTER VARYING(500),
+ "B_LONG_NAME" CHARACTER VARYING(500),
+ "B_DESCRIPTION" CHARACTER VARYING(2000),
+ "B_ENABLED" BOOLEAN,
+ "B_QUALIFIER" CHARACTER VARYING(10),
+ "B_LANGUAGE" CHARACTER VARYING(20),
+ "B_COPY_COMPONENT_UUID" CHARACTER VARYING(50),
+ "B_PATH" CHARACTER VARYING(2000),
+ "B_UUID_PATH" CHARACTER VARYING(1500),
+ "CREATED_AT" TIMESTAMP
+);
+CREATE INDEX "PROJECTS_QUALIFIER" ON "COMPONENTS"("QUALIFIER" NULLS FIRST);
+CREATE INDEX "PROJECTS_ROOT_UUID" ON "COMPONENTS"("ROOT_UUID" NULLS FIRST);
+CREATE INDEX "IDX_MAIN_BRANCH_PRJ_UUID" ON "COMPONENTS"("MAIN_BRANCH_PROJECT_UUID" NULLS FIRST);
+CREATE UNIQUE INDEX "COMPONENTS_UUID" ON "COMPONENTS"("UUID" NULLS FIRST);
+CREATE INDEX "COMPONENTS_BRANCH_UUID" ON "COMPONENTS"("BRANCH_UUID" NULLS FIRST);
+CREATE UNIQUE INDEX "COMPONENTS_KEE_BRANCH_UUID" ON "COMPONENTS"("KEE" NULLS FIRST, "BRANCH_UUID" NULLS FIRST);
diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/component/index/ComponentIndexerTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/component/index/ComponentIndexerTest.java
index fdc466f8237..9cbaeece04f 100644
--- a/server/sonar-server-common/src/test/java/org/sonar/server/component/index/ComponentIndexerTest.java
+++ b/server/sonar-server-common/src/test/java/org/sonar/server/component/index/ComponentIndexerTest.java
@@ -247,7 +247,7 @@ public class ComponentIndexerTest {
ComponentUpdateDto updateComponent = ComponentUpdateDto.copyFrom(component);
updateComponent.setBChanged(true);
dbClient.componentDao().update(dbSession, updateComponent, component.qualifier());
- dbClient.componentDao().applyBChangesForRootComponentUuid(dbSession, component.getRootUuid());
+ dbClient.componentDao().applyBChangesForBranchUuid(dbSession, component.branchUuid());
dbSession.commit();
}
diff --git a/server/sonar-server-common/src/test/resources/org/sonar/server/issue/index/IssueIndexerTest/index.xml b/server/sonar-server-common/src/test/resources/org/sonar/server/issue/index/IssueIndexerTest/index.xml
index 391706e8030..31b217d461e 100644
--- a/server/sonar-server-common/src/test/resources/org/sonar/server/issue/index/IssueIndexerTest/index.xml
+++ b/server/sonar-server-common/src/test/resources/org/sonar/server/issue/index/IssueIndexerTest/index.xml
@@ -9,10 +9,7 @@
<projects organization_uuid="org1"
uuid="THE_PROJECT"
uuid_path="NOT_USED"
- root_uuid="THE_PROJECT"
project_uuid="THE_PROJECT"
- module_uuid="[null]"
- module_uuid_path="."
path="[null]"
id="10"
scope="PRJ"
@@ -23,10 +20,7 @@
<projects organization_uuid="org1"
uuid="THE_FILE"
uuid_path="NOT_USED"
- root_uuid="THE_PROJECT"
project_uuid="THE_PROJECT"
- module_uuid="THE_PROJECT"
- module_uuid_path=".THE_PROJECT."
path="src/main/java/TheFile.java"
id="11"
scope="FIL"
diff --git a/server/sonar-server-common/src/test/resources/org/sonar/server/issue/index/IssueIndexerTest/index_project.xml b/server/sonar-server-common/src/test/resources/org/sonar/server/issue/index/IssueIndexerTest/index_project.xml
index 48aa3d889f4..2800fccb72b 100644
--- a/server/sonar-server-common/src/test/resources/org/sonar/server/issue/index/IssueIndexerTest/index_project.xml
+++ b/server/sonar-server-common/src/test/resources/org/sonar/server/issue/index/IssueIndexerTest/index_project.xml
@@ -10,10 +10,7 @@
<projects organization_uuid="org1"
uuid="THE_PROJECT_1"
uuid_path="NOT_USED"
- root_uuid="THE_PROJECT_1"
project_uuid="THE_PROJECT_1"
- module_uuid="[null]"
- module_uuid_path="."
path="[null]"
id="10"
scope="PRJ"
@@ -24,10 +21,7 @@
<projects organization_uuid="org1"
uuid="THE_FILE_1"
uuid_path="NOT_USED"
- root_uuid="THE_PROJECT_1"
project_uuid="THE_PROJECT_1"
- module_uuid="THE_PROJECT_1"
- module_uuid_path=".THE_PROJECT_1."
path="src/main/java/TheFile.java"
id="11"
scope="FIL"
@@ -68,9 +62,6 @@
<projects organization_uuid="org1"
uuid="THE_PROJECT_2"
uuid_path="NOT_USED"
- root_uuid="THE_PROJECT_2"
- module_uuid="[null]"
- module_uuid_path="."
path="[null]"
id="100"
scope="PRJ"
@@ -81,9 +72,6 @@
<projects organization_uuid="org1"
uuid="THE_FILE_2"
uuid_path="NOT_USED"
- root_uuid="THE_PROJECT_2"
- module_uuid="THE_PROJECT_2"
- module_uuid_path=".THE_PROJECT_2."
path="src/main/java/TheFile.java"
id="111"
scope="FIL"
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/user/ServerUserSessionTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/user/ServerUserSessionTest.java
index 70e0e9e92aa..a5feb662795 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/user/ServerUserSessionTest.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/user/ServerUserSessionTest.java
@@ -302,7 +302,7 @@ public class ServerUserSessionTest {
assertThat(session.hasChildProjectsPermission(USER, application)).isTrue();
// change privacy of the project without updating the cache
- db.getDbClient().componentDao().setPrivateForRootComponentUuidWithoutAudit(db.getSession(), project.uuid(), true);
+ db.getDbClient().componentDao().setPrivateForBranchUuidWithoutAudit(db.getSession(), project.uuid(), true);
assertThat(session.hasChildProjectsPermission(USER, application)).isTrue();
}
@@ -387,7 +387,7 @@ public class ServerUserSessionTest {
assertThat(session.hasChildProjectsPermission(USER, portfolio)).isTrue();
// change privacy of the project without updating the cache
- db.getDbClient().componentDao().setPrivateForRootComponentUuidWithoutAudit(db.getSession(), project.uuid(), true);
+ db.getDbClient().componentDao().setPrivateForBranchUuidWithoutAudit(db.getSession(), project.uuid(), true);
assertThat(session.hasChildProjectsPermission(USER, portfolio)).isTrue();
}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ComponentUpdater.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ComponentUpdater.java
index e6efc5b96fb..acf416b7ba2 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ComponentUpdater.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ComponentUpdater.java
@@ -148,7 +148,6 @@ public class ComponentUpdater {
ComponentDto component = new ComponentDto()
.setUuid(uuid)
.setUuidPath(ComponentDto.UUID_PATH_OF_ROOT)
- .setRootUuid(uuid)
.setBranchUuid(uuid)
.setKey(newComponent.key())
.setName(newComponent.name())
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/project/ws/UpdateVisibilityAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/project/ws/UpdateVisibilityAction.java
index 3310a26cbcc..d0a5533d33e 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/project/ws/UpdateVisibilityAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/project/ws/UpdateVisibilityAction.java
@@ -133,7 +133,7 @@ public class UpdateVisibilityAction implements ProjectsWsAction {
private void setPrivateForRootComponentUuid(DbSession dbSession, ComponentDto component, boolean isPrivate) {
String uuid = component.uuid();
- dbClient.componentDao().setPrivateForRootComponentUuid(dbSession, uuid, isPrivate, component.getKey(), component.qualifier(), component.name());
+ dbClient.componentDao().setPrivateForBranchUuid(dbSession, uuid, isPrivate, component.getKey(), component.qualifier(), component.name());
if (component.qualifier().equals(Qualifiers.PROJECT) || component.qualifier().equals(Qualifiers.APP)) {
dbClient.projectDao().updateVisibility(dbSession, uuid, isPrivate);
@@ -142,7 +142,7 @@ public class UpdateVisibilityAction implements ProjectsWsAction {
ComponentMapper mapper = dbSession.getMapper(ComponentMapper.class);
dbSession.getMapper(BranchMapper.class).selectByProjectUuid(uuid).stream()
.filter(branch -> !uuid.equals(branch.getUuid()))
- .forEach(branch -> mapper.setPrivateForRootComponentUuid(branch.getUuid(), isPrivate));
+ .forEach(branch -> mapper.setPrivateForBranchUuid(branch.getUuid(), isPrivate));
}
private boolean noPendingTask(DbSession dbSession, ComponentDto rootComponent) {
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/batch/ProjectDataLoaderTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/batch/ProjectDataLoaderTest.java
index d68b8866fa1..49458647741 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/batch/ProjectDataLoaderTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/batch/ProjectDataLoaderTest.java
@@ -134,7 +134,6 @@ public class ProjectDataLoaderTest {
dbClient.componentDao().insert(dbSession, new ComponentDto()
.setUuid(uuid)
.setUuidPath(uuid + ".")
- .setRootUuid(uuid)
.setBranchUuid("branchUuid")
.setScope(Scopes.PROJECT)
.setKey("key"));