diff options
author | Lukasz Jarocki <lukasz.jarocki@sonarsource.com> | 2022-10-31 12:25:54 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-11-01 20:03:09 +0000 |
commit | b0be5da0c49b74538dbce98014298a104d4ac5b0 (patch) | |
tree | 6a9b4734fefe01a34ef2b45336276be4fafa1483 /server/sonar-db-dao/src/testFixtures | |
parent | b309ce1704e490af7daef2a0d0ab1bbba8c930b8 (diff) | |
download | sonarqube-b0be5da0c49b74538dbce98014298a104d4ac5b0.tar.gz sonarqube-b0be5da0c49b74538dbce98014298a104d4ac5b0.zip |
SONAR-17524 changing default branch name for projects
Diffstat (limited to 'server/sonar-db-dao/src/testFixtures')
-rw-r--r-- | server/sonar-db-dao/src/testFixtures/java/org/sonar/db/component/ComponentTesting.java | 7 |
1 files changed, 5 insertions, 2 deletions
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 b9d6e5c8b82..251bd2a7363 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 @@ -28,7 +28,8 @@ import org.sonar.db.project.ProjectDto; import static com.google.common.base.Preconditions.checkArgument; import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric; -import static org.sonar.db.component.BranchDto.DEFAULT_MAIN_BRANCH_NAME; +import static org.sonar.db.component.BranchDto.DEFAULT_APPLICATION_MAIN_BRANCH_NAME; +import static org.sonar.db.component.BranchDto.DEFAULT_PROJECT_MAIN_BRANCH_NAME; import static org.sonar.db.component.ComponentDto.UUID_PATH_OF_ROOT; import static org.sonar.db.component.ComponentDto.UUID_PATH_SEPARATOR; import static org.sonar.db.component.ComponentDto.formatUuidPathFromParent; @@ -218,7 +219,9 @@ public class ComponentTesting { public static BranchDto newBranchDto(ComponentDto branchComponent, BranchType branchType) { boolean isMain = branchComponent.getMainBranchProjectUuid() == null; String projectUuid = isMain ? branchComponent.uuid() : branchComponent.getMainBranchProjectUuid(); - String key = isMain ? DEFAULT_MAIN_BRANCH_NAME : "branch_" + randomAlphanumeric(248); + String defaultBranchName = branchComponent.qualifier() != null && branchComponent.qualifier().equals("APP") ? + DEFAULT_APPLICATION_MAIN_BRANCH_NAME : DEFAULT_PROJECT_MAIN_BRANCH_NAME; + String key = isMain ? defaultBranchName : "branch_" + randomAlphanumeric(248); return new BranchDto() .setKey(key) |