aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-db/src
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2017-01-30 18:09:12 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2017-02-01 14:13:02 +0100
commite34eaf8f733e5adad1a7dd286515ff4e7069153b (patch)
treefe717a649e39a4f5068b001af9d12623606b5a81 /sonar-db/src
parenteae95b7c88af8635f61332bad2288d868a81ade8 (diff)
downloadsonarqube-e34eaf8f733e5adad1a7dd286515ff4e7069153b.tar.gz
sonarqube-e34eaf8f733e5adad1a7dd286515ff4e7069153b.zip
SONAR-7946 Remove usage of QProfileFactory
Also replace WsTester by WsActionTester in UT
Diffstat (limited to 'sonar-db/src')
-rw-r--r--sonar-db/src/test/java/org/sonar/db/DbTester.java7
-rw-r--r--sonar-db/src/test/java/org/sonar/db/qualityprofile/QualityProfileDbTester.java3
2 files changed, 8 insertions, 2 deletions
diff --git a/sonar-db/src/test/java/org/sonar/db/DbTester.java b/sonar-db/src/test/java/org/sonar/db/DbTester.java
index b17260ca654..82a2e05d4cd 100644
--- a/sonar-db/src/test/java/org/sonar/db/DbTester.java
+++ b/sonar-db/src/test/java/org/sonar/db/DbTester.java
@@ -73,6 +73,7 @@ import org.sonar.db.organization.OrganizationDto;
import org.sonar.db.organization.OrganizationTesting;
import org.sonar.db.permission.template.PermissionTemplateDbTester;
import org.sonar.db.qualitygate.QualityGateDbTester;
+import org.sonar.db.qualityprofile.QualityProfileDbTester;
import org.sonar.db.rule.RuleDbTester;
import org.sonar.db.user.RootFlagAssertions;
import org.sonar.db.user.UserDbTester;
@@ -115,6 +116,7 @@ public class DbTester extends ExternalResource {
private final RuleDbTester ruleDbTester;
private final NotificationDbTester notificationDbTester;
private final RootFlagAssertions rootFlagAssertions;
+ private final QualityProfileDbTester qualityProfileDbTester;
private DbTester(System2 system2, @Nullable String schemaPath) {
this.system2 = system2;
@@ -131,6 +133,7 @@ public class DbTester extends ExternalResource {
this.ruleDbTester = new RuleDbTester(this);
this.notificationDbTester = new NotificationDbTester(this);
this.rootFlagAssertions = new RootFlagAssertions(this);
+ this.qualityProfileDbTester = new QualityProfileDbTester(this);
}
public static DbTester create() {
@@ -240,6 +243,10 @@ public class DbTester extends ExternalResource {
return notificationDbTester;
}
+ public QualityProfileDbTester qualityProfiles() {
+ return qualityProfileDbTester;
+ }
+
@Override
protected void after() {
if (session != null) {
diff --git a/sonar-db/src/test/java/org/sonar/db/qualityprofile/QualityProfileDbTester.java b/sonar-db/src/test/java/org/sonar/db/qualityprofile/QualityProfileDbTester.java
index 33e123cd74e..d5f5460bff7 100644
--- a/sonar-db/src/test/java/org/sonar/db/qualityprofile/QualityProfileDbTester.java
+++ b/sonar-db/src/test/java/org/sonar/db/qualityprofile/QualityProfileDbTester.java
@@ -40,6 +40,7 @@ public class QualityProfileDbTester {
public QualityProfileDto insertQualityProfile(QualityProfileDto qualityProfile) {
dbClient.qualityProfileDao().insert(dbSession, qualityProfile);
+ dbSession.commit();
return qualityProfile;
}
@@ -48,7 +49,6 @@ public class QualityProfileDbTester {
for (QualityProfileDto qualityProfile : qualityProfiles) {
dbClient.qualityProfileDao().insertProjectProfileAssociation(project.uuid(), qualityProfile.getKey(), dbSession);
}
-
dbSession.commit();
}
@@ -56,7 +56,6 @@ public class QualityProfileDbTester {
for (QualityProfileDto qualityProfile : qualityProfiles) {
dbClient.qualityProfileDao().insertProjectProfileAssociation(project.uuid(), qualityProfile.getKey(), dbSession);
}
-
dbSession.commit();
}