aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-db-dao
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2017-08-22 15:10:53 +0200
committerJanos Gyerik <janos.gyerik@sonarsource.com>2017-09-12 11:34:48 +0200
commit185d5ffdf83dd15fe0f578bbc3b23fdeea2044db (patch)
tree1a4b29c1491b9e211d9dee7866b566eff5ef03d8 /server/sonar-db-dao
parent63302f1ca5371687d2994b0602726bfe08359602 (diff)
downloadsonarqube-185d5ffdf83dd15fe0f578bbc3b23fdeea2044db.tar.gz
sonarqube-185d5ffdf83dd15fe0f578bbc3b23fdeea2044db.zip
SONAR-9616 Allow to return main branch in api/projectbranches/show
Diffstat (limited to 'server/sonar-db-dao')
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDbTester.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDbTester.java b/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDbTester.java
index 172cad17f47..bda32e32bca 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDbTester.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDbTester.java
@@ -216,6 +216,17 @@ public class ComponentDbTester {
}
@SafeVarargs
+ public final ComponentDto insertMainBranch(OrganizationDto organization, String mainBranchName, Consumer<ComponentDto>... dtoPopulators) {
+ ComponentDto project = newPrivateProjectDto(organization);
+ BranchDto branchDto = newBranchDto(project, LONG).setKey(mainBranchName);
+ Arrays.stream(dtoPopulators).forEach(dtoPopulator -> dtoPopulator.accept(project));
+ insertComponent(project);
+ dbClient.branchDao().insert(dbSession, branchDto);
+ db.commit();
+ return project;
+ }
+
+ @SafeVarargs
public final ComponentDto insertProjectBranch(ComponentDto project, Consumer<BranchDto>... dtoPopulators) {
// MainBranchProjectUuid will be null if it's a main branch
BranchDto branchDto = newBranchDto(firstNonNull(project.getMainBranchProjectUuid(), project.projectUuid()), LONG);