From 781f6976f9b44bec7d2a545f2407cabdfbf4c7a2 Mon Sep 17 00:00:00 2001 From: Aurelien Poscia Date: Wed, 5 Jul 2023 11:27:38 +0200 Subject: [PATCH] SONAR-19784 allow the CE to re-compute permissions --- .../org/sonar/ce/container/ComputeEngineContainerImpl.java | 4 +++- server/sonar-server-common/build.gradle | 2 ++ .../org/sonar/server/permission/index/PermissionIndexer.java | 0 .../sonar/server/permission/index/PermissionIndexerDao.java | 0 .../sonar/server/permission/index/PermissionIndexerDaoIT.java | 0 .../sonar/server/permission/index/PermissionIndexerTest.java | 0 .../java/org/sonar/server/permission/index/FooIndex.java | 0 .../java/org/sonar/server/permission/index/FooIndexer.java | 0 8 files changed, 5 insertions(+), 1 deletion(-) rename server/{sonar-webserver-es => sonar-server-common}/src/main/java/org/sonar/server/permission/index/PermissionIndexer.java (100%) rename server/{sonar-webserver-es => sonar-server-common}/src/main/java/org/sonar/server/permission/index/PermissionIndexerDao.java (100%) rename server/{sonar-webserver-es/src/it => sonar-server-common/src/test}/java/org/sonar/server/permission/index/PermissionIndexerDaoIT.java (100%) rename server/{sonar-webserver-es => sonar-server-common}/src/test/java/org/sonar/server/permission/index/PermissionIndexerTest.java (100%) rename server/sonar-webserver-es/src/{test => testFixtures}/java/org/sonar/server/permission/index/FooIndex.java (100%) rename server/sonar-webserver-es/src/{test => testFixtures}/java/org/sonar/server/permission/index/FooIndexer.java (100%) diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java index 3ac0a968169..bff8ef8ec94 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java @@ -23,6 +23,7 @@ import com.google.common.annotations.VisibleForTesting; import java.time.Clock; import java.util.List; import javax.annotation.CheckForNull; +import org.slf4j.LoggerFactory; import org.sonar.api.SonarEdition; import org.sonar.api.SonarQubeSide; import org.sonar.api.config.EmailSettings; @@ -38,7 +39,6 @@ import org.sonar.api.utils.Durations; import org.sonar.api.utils.System2; import org.sonar.api.utils.UriReader; import org.sonar.api.utils.Version; -import org.slf4j.LoggerFactory; import org.sonar.ce.CeConfigurationModule; import org.sonar.ce.CeDistributedInformationImpl; import org.sonar.ce.CeHttpModule; @@ -115,6 +115,7 @@ import org.sonar.server.metric.UnanalyzedLanguageMetrics; import org.sonar.server.notification.DefaultNotificationManager; import org.sonar.server.notification.NotificationService; import org.sonar.server.notification.email.EmailNotificationChannel; +import org.sonar.server.permission.index.PermissionIndexer; import org.sonar.server.platform.DefaultNodeInformation; import org.sonar.server.platform.OfficialDistribution; import org.sonar.server.platform.ServerFileSystemImpl; @@ -387,6 +388,7 @@ public class ComputeEngineContainerImpl implements ComputeEngineContainer { QGChangeNotificationHandler.newMetadata(), ProjectMeasuresIndexer.class, EntityDefinitionIndexer.class, + PermissionIndexer.class, // views ViewIndexer.class, diff --git a/server/sonar-server-common/build.gradle b/server/sonar-server-common/build.gradle index 0ba7fb41ca6..64183060fd8 100644 --- a/server/sonar-server-common/build.gradle +++ b/server/sonar-server-common/build.gradle @@ -42,6 +42,8 @@ dependencies { testImplementation 'org.mockito:mockito-core' testImplementation 'org.sonarsource.api.plugin:sonar-plugin-api-test-fixtures' testImplementation testFixtures(project(':server:sonar-db-dao')) + testImplementation testFixtures(project(':server:sonar-webserver-auth')) + testImplementation testFixtures(project(':server:sonar-webserver-es')) testImplementation project(':sonar-plugin-api-impl') testImplementation project(':sonar-testing-harness') diff --git a/server/sonar-webserver-es/src/main/java/org/sonar/server/permission/index/PermissionIndexer.java b/server/sonar-server-common/src/main/java/org/sonar/server/permission/index/PermissionIndexer.java similarity index 100% rename from server/sonar-webserver-es/src/main/java/org/sonar/server/permission/index/PermissionIndexer.java rename to server/sonar-server-common/src/main/java/org/sonar/server/permission/index/PermissionIndexer.java diff --git a/server/sonar-webserver-es/src/main/java/org/sonar/server/permission/index/PermissionIndexerDao.java b/server/sonar-server-common/src/main/java/org/sonar/server/permission/index/PermissionIndexerDao.java similarity index 100% rename from server/sonar-webserver-es/src/main/java/org/sonar/server/permission/index/PermissionIndexerDao.java rename to server/sonar-server-common/src/main/java/org/sonar/server/permission/index/PermissionIndexerDao.java diff --git a/server/sonar-webserver-es/src/it/java/org/sonar/server/permission/index/PermissionIndexerDaoIT.java b/server/sonar-server-common/src/test/java/org/sonar/server/permission/index/PermissionIndexerDaoIT.java similarity index 100% rename from server/sonar-webserver-es/src/it/java/org/sonar/server/permission/index/PermissionIndexerDaoIT.java rename to server/sonar-server-common/src/test/java/org/sonar/server/permission/index/PermissionIndexerDaoIT.java diff --git a/server/sonar-webserver-es/src/test/java/org/sonar/server/permission/index/PermissionIndexerTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/permission/index/PermissionIndexerTest.java similarity index 100% rename from server/sonar-webserver-es/src/test/java/org/sonar/server/permission/index/PermissionIndexerTest.java rename to server/sonar-server-common/src/test/java/org/sonar/server/permission/index/PermissionIndexerTest.java diff --git a/server/sonar-webserver-es/src/test/java/org/sonar/server/permission/index/FooIndex.java b/server/sonar-webserver-es/src/testFixtures/java/org/sonar/server/permission/index/FooIndex.java similarity index 100% rename from server/sonar-webserver-es/src/test/java/org/sonar/server/permission/index/FooIndex.java rename to server/sonar-webserver-es/src/testFixtures/java/org/sonar/server/permission/index/FooIndex.java diff --git a/server/sonar-webserver-es/src/test/java/org/sonar/server/permission/index/FooIndexer.java b/server/sonar-webserver-es/src/testFixtures/java/org/sonar/server/permission/index/FooIndexer.java similarity index 100% rename from server/sonar-webserver-es/src/test/java/org/sonar/server/permission/index/FooIndexer.java rename to server/sonar-webserver-es/src/testFixtures/java/org/sonar/server/permission/index/FooIndexer.java -- 2.39.5