aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-db-dao
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2017-07-17 18:19:48 +0200
committerJulien Lancelot <julien.lancelot@sonarsource.com>2017-07-31 11:27:51 +0200
commit3aa22c853b36df2d47b09793623757d142885627 (patch)
tree6ed190b98d3d62f17b3c9dd56613e32bd29de77b /server/sonar-db-dao
parentc2cf8d0f0baed53b82b34c731386311b14915ecf (diff)
downloadsonarqube-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.java9
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentTesting.java5
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)