From 3fb59f2b5f1b9d5a04404ebc08c78df95a3377b0 Mon Sep 17 00:00:00 2001 From: Teryk Bellahsene Date: Tue, 12 Sep 2017 16:28:08 +0200 Subject: [PATCH] SONAR-9813 Add methods to create portfolio and application with visibility in ComponentDbTester --- .../sonar/db/component/ComponentDbTester.java | 56 ++++++++++++++++--- 1 file changed, 49 insertions(+), 7 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 bda32e32bca..ddd63f27043 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 @@ -114,45 +114,87 @@ public class ComponentDbTester { return insertComponentImpl(newPublicProjectDto(organizationDto, uuid), false, noExtraConfiguration()); } + /** + * @deprecated since 6.6 + * @see #insertPublicPortfolio(OrganizationDto, Consumer[]) + */ + @Deprecated public ComponentDto insertView() { return insertComponentImpl(newView(db.getDefaultOrganization()), false, noExtraConfiguration()); } + /** + * @deprecated since 6.6 + * @see #insertPublicPortfolio(OrganizationDto, Consumer[]) + */ public ComponentDto insertView(Consumer dtoPopulator) { return insertComponentImpl(newView(db.getDefaultOrganization()), false, dtoPopulator); } + /** + * @deprecated since 6.6 + * @see #insertPublicPortfolio(OrganizationDto, Consumer[]) + */ public ComponentDto insertView(OrganizationDto organizationDto) { return insertComponentImpl(newView(organizationDto), false, noExtraConfiguration()); } + /** + * @deprecated since 6.6 + * @see #insertPublicPortfolio(OrganizationDto, Consumer[]) + */ public ComponentDto insertView(OrganizationDto organizationDto, Consumer dtoPopulator) { return insertComponentImpl(newView(organizationDto), false, dtoPopulator); } + /** + * @deprecated since 6.6 + * @see #insertPublicPortfolio(OrganizationDto, Consumer[]) + */ public ComponentDto insertView(String uuid) { return insertComponentImpl(newView(db.getDefaultOrganization(), uuid), false, noExtraConfiguration()); } + /** + * @deprecated since 6.6 + * @see #insertPublicPortfolio(OrganizationDto, Consumer[]) + */ public ComponentDto insertView(OrganizationDto organizationDto, String uuid) { return insertComponentImpl(newView(organizationDto, uuid), false, noExtraConfiguration()); } - public ComponentDto insertApplication(OrganizationDto organizationDto) { - return insertComponentImpl(newApplication(organizationDto), false, noExtraConfiguration()); + @SafeVarargs + public final ComponentDto insertPublicPortfolio(OrganizationDto organization, Consumer... dtoPopulators) { + return insertComponentImpl(newView(organization).setPrivate(false), false, dtoPopulators); } - public ComponentDto insertApplication(OrganizationDto organizationDto, Consumer... dtoPopulators) { - return insertComponentImpl(newApplication(organizationDto), false, dtoPopulators); + @SafeVarargs + public final ComponentDto insertPrivatePortfolio(OrganizationDto organization, Consumer... dtoPopulators) { + return insertComponentImpl(newView(organization).setPrivate(true), true, dtoPopulators); + } + + @SafeVarargs + public final ComponentDto insertPublicApplication(OrganizationDto organization, Consumer... dtoPopulators) { + return insertComponentImpl(newApplication(organization).setPrivate(false), false, dtoPopulators); } - public ComponentDto insertSubView(ComponentDto view, Consumer dtoPopulator) { - return insertComponentImpl(newSubView(view), false, dtoPopulator); + @SafeVarargs + public final ComponentDto insertPrivateApplication(OrganizationDto organization, Consumer... dtoPopulators) { + return insertComponentImpl(newApplication(organization).setPrivate(true), true, dtoPopulators); + } + + /** + * @deprecated since 6.6 + * @see #insertPublicApplication(OrganizationDto, Consumer[]) + */ + @SafeVarargs + public final ComponentDto insertApplication(OrganizationDto organizationDto, Consumer... dtoPopulators) { + return insertComponentImpl(newApplication(organizationDto), false, dtoPopulators); } @SafeVarargs public final ComponentDto insertSubView(ComponentDto view, Consumer... dtoPopulators) { - return insertComponentImpl(newSubView(view), false, dtoPopulators); + return insertComponentImpl(newSubView(view), view.isPrivate(), dtoPopulators); } private static Consumer noExtraConfiguration() { -- 2.39.5