aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-ce-task-projectanalysis
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2022-09-28 10:31:10 -0500
committersonartech <sonartech@sonarsource.com>2022-10-12 20:03:44 +0000
commitebc870fa3d67138d8a45a152cd5d024395b9ad2f (patch)
tree1c1370d7dc20561e5b90fbe73325c806f74f82b7 /server/sonar-ce-task-projectanalysis
parentd9a12fc4c11a83195e121041390181aab142960a (diff)
downloadsonarqube-ebc870fa3d67138d8a45a152cd5d024395b9ad2f.tar.gz
sonarqube-ebc870fa3d67138d8a45a152cd5d024395b9ad2f.zip
SONAR-17352 Refactor component keys to not include branch suffix
Diffstat (limited to 'server/sonar-ce-task-projectanalysis')
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/analysis/ProjectConfigurationFactory.java13
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportPersistComponentsStepTest.java3
2 files changed, 5 insertions, 11 deletions
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/analysis/ProjectConfigurationFactory.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/analysis/ProjectConfigurationFactory.java
index eac29025308..4d65f853965 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/analysis/ProjectConfigurationFactory.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/analysis/ProjectConfigurationFactory.java
@@ -21,15 +21,11 @@ package org.sonar.ce.task.projectanalysis.analysis;
import org.sonar.api.ce.ComputeEngineSide;
import org.sonar.api.config.Configuration;
-import org.sonar.api.config.internal.Settings;
import org.sonar.api.config.internal.ConfigurationBridge;
+import org.sonar.api.config.internal.Settings;
import org.sonar.db.DbClient;
-import org.sonar.db.component.BranchType;
import org.sonar.server.setting.ChildSettings;
-import static org.sonar.db.component.ComponentDto.generateBranchKey;
-import static org.sonar.db.component.ComponentDto.generatePullRequestKey;
-
@ComputeEngineSide
public class ProjectConfigurationFactory {
@@ -44,11 +40,8 @@ public class ProjectConfigurationFactory {
public Configuration newProjectConfiguration(String projectKey, Branch branch) {
Settings projectSettings = new ChildSettings(globalSettings);
addSettings(projectSettings, projectKey);
- if (branch.getType() == BranchType.PULL_REQUEST) {
- addSettings(projectSettings, generatePullRequestKey(projectKey, branch.getPullRequestKey()));
- } else {
- addSettings(projectSettings, generateBranchKey(projectKey, branch.getName()));
- }
+ // TODO branch / PR
+ addSettings(projectSettings, projectKey);
return new ConfigurationBridge(projectSettings);
}
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 18fe2164751..0f8bf052a3d 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
@@ -172,7 +172,8 @@ public class ReportPersistComponentsStepTest extends BaseStepTest {
underTest.execute(new TestComputationStepContext());
- assertThat(db.countRowsOfTable("components")).isEqualTo(3);
+ // 3 in this branch plus the project
+ assertThat(db.countRowsOfTable("components")).isEqualTo(4);
ComponentDto directoryDto = dbClient.componentDao().selectByKeyAndBranch(db.getSession(), "PROJECT_KEY:src/main/java/dir", "feature/foo").get();
assertThat(directoryDto.name()).isEqualTo("dir");