diff options
Diffstat (limited to 'server/sonar-db-dao')
4 files changed, 21 insertions, 17 deletions
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 ee252a2de80..ce2c20418a7 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 @@ -78,7 +78,7 @@ import static org.sonar.db.component.ComponentTesting.newModuleDto; import static org.sonar.db.component.ComponentTesting.newPrivateProjectDto; import static org.sonar.db.component.ComponentTesting.newProjectCopy; import static org.sonar.db.component.ComponentTesting.newSubView; -import static org.sonar.db.component.ComponentTesting.newView; +import static org.sonar.db.component.ComponentTesting.newPortfolio; import static org.sonar.db.component.ComponentTreeQuery.Strategy.CHILDREN; import static org.sonar.db.component.ComponentTreeQuery.Strategy.LEAVES; import javax.annotation.Nullable; @@ -1009,7 +1009,7 @@ public class ComponentDaoTest { ComponentDto provisionedView = db.components().insertPrivatePortfolio(); String projectUuid = db.components().insertProjectAndSnapshot(newPrivateProjectDto()).getComponentUuid(); String disabledProjectUuid = db.components().insertProjectAndSnapshot(newPrivateProjectDto().setEnabled(false)).getComponentUuid(); - String viewUuid = db.components().insertProjectAndSnapshot(ComponentTesting.newView()).getComponentUuid(); + String viewUuid = db.components().insertProjectAndSnapshot(ComponentTesting.newPortfolio()).getComponentUuid(); assertThat(underTest.selectProjects(dbSession)) .extracting(ComponentDto::uuid) @@ -1035,7 +1035,7 @@ public class ComponentDaoTest { SnapshotDto analyzedProject = db.components().insertProjectAndSnapshot(newPrivateProjectDto()); SnapshotDto analyzedDisabledProject = db.components().insertProjectAndSnapshot(newPrivateProjectDto() .setEnabled(false)); - SnapshotDto analyzedPortfolio = db.components().insertProjectAndSnapshot(ComponentTesting.newView()); + SnapshotDto analyzedPortfolio = db.components().insertProjectAndSnapshot(ComponentTesting.newPortfolio()); Supplier<ComponentQuery.Builder> query = () -> ComponentQuery.builder().setQualifiers(PROJECT).setOnProvisionedOnly(true); assertThat(underTest.selectByQuery(dbSession, query.get().build(), 0, 10)) @@ -1119,7 +1119,7 @@ public class ComponentDaoTest { public void count_provisioned() { db.components().insertPrivateProject(); db.components().insertProjectAndSnapshot(newPrivateProjectDto()); - db.components().insertProjectAndSnapshot(ComponentTesting.newView()); + db.components().insertProjectAndSnapshot(ComponentTesting.newPortfolio()); Supplier<ComponentQuery.Builder> query = () -> ComponentQuery.builder().setOnProvisionedOnly(true); assertThat(underTest.countByQuery(dbSession, query.get().setQualifiers(PROJECT).build())).isEqualTo(1); @@ -1353,7 +1353,7 @@ public class ComponentDaoTest { @Test public void selectByQuery_with_paging_query_and_qualifiers() { db.components().insertProjectAndSnapshot(newPrivateProjectDto().setName("aaaa-name")); - db.components().insertProjectAndSnapshot(newView()); + db.components().insertProjectAndSnapshot(newPortfolio()); for (int i = 9; i >= 1; i--) { db.components().insertProjectAndSnapshot(newPrivateProjectDto().setName("project-" + i)); } @@ -1755,7 +1755,7 @@ public class ComponentDaoTest { @Test public void select_descendants_of_a_view_and_filter_by_name() { - ComponentDto view = newView(A_VIEW_UUID); + ComponentDto view = ComponentTesting.newPortfolio(A_VIEW_UUID); db.components().insertViewAndSnapshot(view); // one subview ComponentDto subView = newSubView(view, "subview-uuid", "subview-key").setName("subview name"); @@ -1843,7 +1843,7 @@ public class ComponentDaoTest { public void existAnyOfComponentsWithQualifiers() { ComponentDto projectDto = db.components().insertComponent(newPrivateProjectDto()); - ComponentDto view = db.components().insertComponent(newView()); + ComponentDto view = db.components().insertComponent(newPortfolio()); ComponentDto subview = db.components().insertComponent(newSubView(view)); ComponentDto app = db.components().insertComponent(newApplication()); diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeCommandsTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeCommandsTest.java index c668464d730..2ae4fc8bf4c 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeCommandsTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeCommandsTest.java @@ -758,7 +758,7 @@ public class PurgeCommandsTest { @DataProvider public static Object[] views() { return new Object[] { - ComponentTesting.newView(), ComponentTesting.newApplication() + ComponentTesting.newPortfolio(), ComponentTesting.newApplication() }; } diff --git a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/component/ComponentDbTester.java b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/component/ComponentDbTester.java index 2a5b1680f7b..603528cdb08 100644 --- a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/component/ComponentDbTester.java +++ b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/component/ComponentDbTester.java @@ -151,6 +151,10 @@ public class ComponentDbTester { return insertComponentAndBranchAndProject(ComponentTesting.newPrivateProjectDto(), true, branchPopulator, componentPopulator); } + public final ComponentDto insertPublicProjectWithCustomBranch(Consumer<BranchDto> branchPopulator, Consumer<ComponentDto> componentPopulator) { + return insertComponentAndBranchAndProject(ComponentTesting.newPublicProjectDto(), false, branchPopulator, componentPopulator); + } + public final ComponentDto insertPrivateProjectWithCustomBranch(Consumer<BranchDto> branchPopulator, Consumer<ComponentDto> componentPopulator, Consumer<ProjectDto> projectPopulator) { return insertComponentAndBranchAndProject(ComponentTesting.newPrivateProjectDto(), true, branchPopulator, componentPopulator, projectPopulator); @@ -161,23 +165,23 @@ public class ComponentDbTester { } public final ComponentDto insertPublicPortfolio(String uuid, Consumer<ComponentDto> dtoPopulator) { - return insertComponentImpl(ComponentTesting.newView(uuid).setPrivate(false), false, dtoPopulator); + return insertComponentImpl(ComponentTesting.newPortfolio(uuid).setPrivate(false), false, dtoPopulator); } public final ComponentDto insertPublicPortfolio(Consumer<ComponentDto> dtoPopulator) { - return insertComponentImpl(ComponentTesting.newView().setPrivate(false), false, dtoPopulator); + return insertComponentImpl(ComponentTesting.newPortfolio().setPrivate(false), false, dtoPopulator); } public final ComponentDto insertPrivatePortfolio() { - return insertComponentImpl(ComponentTesting.newView().setPrivate(true), true, defaults()); + return insertComponentImpl(ComponentTesting.newPortfolio().setPrivate(true), true, defaults()); } public final ComponentDto insertPrivatePortfolio(String uuid, Consumer<ComponentDto> dtoPopulator) { - return insertComponentImpl(ComponentTesting.newView(uuid).setPrivate(true), true, dtoPopulator); + return insertComponentImpl(ComponentTesting.newPortfolio(uuid).setPrivate(true), true, dtoPopulator); } public final ComponentDto insertPrivatePortfolio(Consumer<ComponentDto> dtoPopulator) { - return insertComponentImpl(ComponentTesting.newView().setPrivate(true), true, dtoPopulator); + return insertComponentImpl(ComponentTesting.newPortfolio().setPrivate(true), true, dtoPopulator); } public final ComponentDto insertPublicApplication() { 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 922794a3f5c..ce9fb35eea8 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 @@ -155,11 +155,11 @@ public class ComponentTesting { .setPrivate(isPrivate); } - public static ComponentDto newView() { - return newView(Uuids.createFast()); + public static ComponentDto newPortfolio() { + return newPortfolio(Uuids.createFast()); } - public static ComponentDto newView(String uuid) { + public static ComponentDto newPortfolio(String uuid) { return newPrivateProjectDto(uuid) .setUuid(uuid) .setScope(Scopes.PROJECT) @@ -168,7 +168,7 @@ public class ComponentTesting { } public static ComponentDto newApplication() { - return newView(Uuids.createFast()).setQualifier(Qualifiers.APP); + return newPortfolio(Uuids.createFast()).setQualifier(Qualifiers.APP); } public static ComponentDto newProjectCopy(ComponentDto project, ComponentDto view) { |