]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9813 Add methods to create portfolio and application with visibility in Compone...
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Tue, 12 Sep 2017 14:28:08 +0000 (16:28 +0200)
committerTeryk Bellahsene <teryk@users.noreply.github.com>
Wed, 20 Sep 2017 07:15:23 +0000 (09:15 +0200)
server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDbTester.java

index bda32e32bca458d6ec9fd38869c4bcec686d785f..ddd63f27043aba03e8c10e8313d6eecfe5168fb3 100644 (file)
@@ -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<ComponentDto> 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<ComponentDto> 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<ComponentDto>... dtoPopulators) {
+    return insertComponentImpl(newView(organization).setPrivate(false), false, dtoPopulators);
   }
 
-  public ComponentDto insertApplication(OrganizationDto organizationDto, Consumer<ComponentDto>... dtoPopulators) {
-    return insertComponentImpl(newApplication(organizationDto), false, dtoPopulators);
+  @SafeVarargs
+  public final ComponentDto insertPrivatePortfolio(OrganizationDto organization, Consumer<ComponentDto>... dtoPopulators) {
+    return insertComponentImpl(newView(organization).setPrivate(true), true, dtoPopulators);
+  }
+
+  @SafeVarargs
+  public final ComponentDto insertPublicApplication(OrganizationDto organization, Consumer<ComponentDto>... dtoPopulators) {
+    return insertComponentImpl(newApplication(organization).setPrivate(false), false, dtoPopulators);
   }
 
-  public ComponentDto insertSubView(ComponentDto view, Consumer<ComponentDto> dtoPopulator) {
-    return insertComponentImpl(newSubView(view), false, dtoPopulator);
+  @SafeVarargs
+  public final ComponentDto insertPrivateApplication(OrganizationDto organization, Consumer<ComponentDto>... 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<ComponentDto>... dtoPopulators) {
+    return insertComponentImpl(newApplication(organizationDto), false, dtoPopulators);
   }
 
   @SafeVarargs
   public final ComponentDto insertSubView(ComponentDto view, Consumer<ComponentDto>... dtoPopulators) {
-    return insertComponentImpl(newSubView(view), false, dtoPopulators);
+    return insertComponentImpl(newSubView(view), view.isPrivate(), dtoPopulators);
   }
 
   private static <T> Consumer<T> noExtraConfiguration() {