diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2017-07-17 18:19:48 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2017-07-31 11:27:51 +0200 |
commit | 3aa22c853b36df2d47b09793623757d142885627 (patch) | |
tree | 6ed190b98d3d62f17b3c9dd56613e32bd29de77b /server/sonar-db-dao | |
parent | c2cf8d0f0baed53b82b34c731386311b14915ecf (diff) | |
download | sonarqube-3aa22c853b36df2d47b09793623757d142885627.tar.gz sonarqube-3aa22c853b36df2d47b09793623757d142885627.zip |
SONAR-9551 Use view templates for applications
Diffstat (limited to 'server/sonar-db-dao')
-rw-r--r-- | server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDbTester.java | 9 | ||||
-rw-r--r-- | server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentTesting.java | 5 |
2 files changed, 14 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 5d1f6b7973f..e434b210da7 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 @@ -29,6 +29,7 @@ import org.sonar.db.organization.OrganizationDto; import static com.google.common.base.Preconditions.checkState; import static java.util.Arrays.asList; +import static org.sonar.db.component.ComponentTesting.newApplication; import static org.sonar.db.component.ComponentTesting.newPrivateProjectDto; import static org.sonar.db.component.ComponentTesting.newPublicProjectDto; import static org.sonar.db.component.ComponentTesting.newView; @@ -133,6 +134,14 @@ public class ComponentDbTester { return insertComponentImpl(newView(organizationDto, uuid), false, noExtraConfiguration()); } + public ComponentDto insertApplication(OrganizationDto organizationDto) { + return insertComponentImpl(newApplication(organizationDto), false, noExtraConfiguration()); + } + + public ComponentDto insertApplication(OrganizationDto organizationDto, Consumer<ComponentDto> dtoPopulator) { + return insertComponentImpl(newApplication(organizationDto), false, dtoPopulator); + } + private static <T> Consumer<T> noExtraConfiguration() { return (t) -> { }; diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentTesting.java b/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentTesting.java index 3445b4778b4..45c6707cc64 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentTesting.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentTesting.java @@ -153,6 +153,11 @@ public class ComponentTesting { .setQualifier(Qualifiers.VIEW); } + public static ComponentDto newApplication(OrganizationDto organizationDto) { + return newView(organizationDto.getUuid(), Uuids.createFast()) + .setQualifier(Qualifiers.APP); + } + public static ComponentDto newProjectCopy(String uuid, ComponentDto project, ComponentDto view) { checkNotNull(project.getId(), "The project need to be persisted before creating this technical project."); return newChildComponent(uuid, view, view) |