aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-webserver-auth/src
diff options
context:
space:
mode:
authorPierre <pierre.guillot@sonarsource.com>2020-09-24 14:21:10 +0200
committersonartech <sonartech@sonarsource.com>2020-10-05 20:07:42 +0000
commit13d76f2a2c2e5b42b3d74bf1ad0c4dbbeca14608 (patch)
treece8c16540053ae25ed9ad8b31072ba204a4a34fc /server/sonar-webserver-auth/src
parent68c364f416ced3893457300257c1c5df1eef8ce7 (diff)
downloadsonarqube-13d76f2a2c2e5b42b3d74bf1ad0c4dbbeca14608.tar.gz
sonarqube-13d76f2a2c2e5b42b3d74bf1ad0c4dbbeca14608.zip
SONAR-13903 Remove use of organizations in Quality Profiles and Active Rules
Diffstat (limited to 'server/sonar-webserver-auth/src')
-rw-r--r--server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/MemberUpdater.java1
-rw-r--r--server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/OrganizationUpdaterImpl.java6
-rw-r--r--server/sonar-webserver-auth/src/main/java/org/sonar/server/qualityprofile/BuiltInQProfileInsert.java2
-rw-r--r--server/sonar-webserver-auth/src/main/java/org/sonar/server/qualityprofile/BuiltInQProfileInsertImpl.java42
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/organization/MemberUpdaterTest.java24
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/organization/OrganizationUpdaterImplTest.java4
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/qualityprofile/BuiltInQProfileInsertImplTest.java54
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/qualityprofile/BuiltInQProfileUpdateImplTest.java11
8 files changed, 37 insertions, 107 deletions
diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/MemberUpdater.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/MemberUpdater.java
index 35532d1aafd..6abfa5f6505 100644
--- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/MemberUpdater.java
+++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/MemberUpdater.java
@@ -137,7 +137,6 @@ public class MemberUpdater {
String organizationUuid = organization.getUuid();
dbClient.userPermissionDao().deleteOrganizationMemberPermissions(dbSession, organizationUuid, userUuid);
dbClient.permissionTemplateDao().deleteUserPermissionsByOrganization(dbSession, organizationUuid, userUuid);
- dbClient.qProfileEditUsersDao().deleteByOrganizationAndUser(dbSession, organization, user);
dbClient.userGroupDao().deleteByOrganizationAndUser(dbSession, organizationUuid, userUuid);
dbClient.propertiesDao().deleteByOrganizationAndUser(dbSession, organizationUuid, userUuid);
dbClient.propertiesDao().deleteByOrganizationAndMatchingLogin(dbSession, organizationUuid, user.getLogin(), singletonList(DEFAULT_ISSUE_ASSIGNEE));
diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/OrganizationUpdaterImpl.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/OrganizationUpdaterImpl.java
index d3e41a8bf14..3b1688861e0 100644
--- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/OrganizationUpdaterImpl.java
+++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/OrganizationUpdaterImpl.java
@@ -104,7 +104,7 @@ public class OrganizationUpdaterImpl implements OrganizationUpdater {
addCurrentUserToGroup(dbSession, ownerGroup, userCreator.getUuid());
addCurrentUserToGroup(dbSession, defaultGroup, userCreator.getUuid());
try (DbSession batchDbSession = dbClient.openSession(true)) {
- insertQualityProfiles(dbSession, batchDbSession, organization);
+ insertQualityProfiles(dbSession, batchDbSession);
batchDbSession.commit();
// Elasticsearch is updated when DB session is committed
@@ -186,14 +186,13 @@ public class OrganizationUpdaterImpl implements OrganizationUpdater {
dbClient.permissionTemplateDao().insertGroupPermission(dbSession, template.getUuid(), group == null ? null : group.getUuid(), permission);
}
- private void insertQualityProfiles(DbSession dbSession, DbSession batchDbSession, OrganizationDto organization) {
+ private void insertQualityProfiles(DbSession dbSession, DbSession batchDbSession) {
Map<QProfileName, BuiltInQProfile> builtInsPerName = builtInQProfileRepository.get().stream()
.collect(uniqueIndex(BuiltInQProfile::getQProfileName));
List<DefaultQProfileDto> defaults = new ArrayList<>();
dbClient.qualityProfileDao().selectBuiltInRuleProfiles(dbSession).forEach(rulesProfile -> {
OrgQProfileDto dto = new OrgQProfileDto()
- .setOrganizationUuid(organization.getUuid())
.setRulesProfileUuid(rulesProfile.getUuid())
.setUuid(uuidFactory.create());
@@ -205,7 +204,6 @@ public class OrganizationUpdaterImpl implements OrganizationUpdater {
// in order to benefit from batch SQL inserts
defaults.add(new DefaultQProfileDto()
.setQProfileUuid(dto.getUuid())
- .setOrganizationUuid(organization.getUuid())
.setLanguage(rulesProfile.getLanguage()));
}
diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/qualityprofile/BuiltInQProfileInsert.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/qualityprofile/BuiltInQProfileInsert.java
index f0e7d54cb21..654fdb29c3d 100644
--- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/qualityprofile/BuiltInQProfileInsert.java
+++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/qualityprofile/BuiltInQProfileInsert.java
@@ -23,7 +23,7 @@ import org.sonar.db.DbSession;
public interface BuiltInQProfileInsert {
/**
- * Persist a new built-in profile and associate it to all existing organizations.
+ * Persist a new built-in profile
* Db sessions are committed and Elasticsearch indices are updated..
*/
void create(DbSession session, DbSession batchSession, BuiltInQProfile builtInQProfile);
diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/qualityprofile/BuiltInQProfileInsertImpl.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/qualityprofile/BuiltInQProfileInsertImpl.java
index ceebfeff22e..8c3b290b79e 100644
--- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/qualityprofile/BuiltInQProfileInsertImpl.java
+++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/qualityprofile/BuiltInQProfileInsertImpl.java
@@ -22,7 +22,6 @@ package org.sonar.server.qualityprofile;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
@@ -88,7 +87,7 @@ public class BuiltInQProfileInsertImpl implements BuiltInQProfileInsert {
changes.forEach(change -> dbClient.qProfileChangeDao().insert(batchDbSession, change.toDto(null)));
- associateToOrganizations(dbSession, batchDbSession, builtInQProfile, ruleProfile);
+ createDefaultAndOrgQProfiles(dbSession, batchDbSession, builtInQProfile, ruleProfile);
// TODO batch statements should be executed through dbSession
batchDbSession.commit();
@@ -96,30 +95,21 @@ public class BuiltInQProfileInsertImpl implements BuiltInQProfileInsert {
activeRuleIndexer.commitAndIndex(dbSession, changes);
}
- private void associateToOrganizations(DbSession dbSession, DbSession batchDbSession, BuiltInQProfile builtIn, RulesProfileDto rulesProfileDto) {
- List<String> orgUuids = dbClient.organizationDao().selectAllUuids(dbSession);
- Set<String> orgUuidsWithoutDefault = dbClient.defaultQProfileDao().selectUuidsOfOrganizationsWithoutDefaultProfile(dbSession, builtIn.getLanguage());
-
- List<DefaultQProfileDto> defaults = new ArrayList<>();
- orgUuids.forEach(orgUuid -> {
- OrgQProfileDto dto = new OrgQProfileDto()
- .setOrganizationUuid(orgUuid)
- .setRulesProfileUuid(rulesProfileDto.getUuid())
- .setUuid(uuidFactory.create());
-
- if (builtIn.isDefault() && orgUuidsWithoutDefault.contains(orgUuid)) {
- // rows of table default_qprofiles must be inserted after
- // in order to benefit from batch SQL inserts
- defaults.add(new DefaultQProfileDto()
- .setQProfileUuid(dto.getUuid())
- .setOrganizationUuid(orgUuid)
- .setLanguage(builtIn.getLanguage()));
- }
-
- dbClient.qualityProfileDao().insert(batchDbSession, dto);
- });
-
- defaults.forEach(defaultQProfileDto -> dbClient.defaultQProfileDao().insertOrUpdate(dbSession, defaultQProfileDto));
+ private void createDefaultAndOrgQProfiles(DbSession dbSession, DbSession batchDbSession, BuiltInQProfile builtIn, RulesProfileDto rulesProfileDto) {
+ Optional<String> qProfileUuid = dbClient.defaultQProfileDao().selectDefaultQProfileUuid(dbSession, builtIn.getLanguage());
+
+ OrgQProfileDto dto = new OrgQProfileDto()
+ .setRulesProfileUuid(rulesProfileDto.getUuid())
+ .setUuid(uuidFactory.create());
+
+ if (builtIn.isDefault() && !qProfileUuid.isPresent()) {
+ DefaultQProfileDto defaultQProfileDto = new DefaultQProfileDto()
+ .setQProfileUuid(dto.getUuid())
+ .setLanguage(builtIn.getLanguage());
+ dbClient.defaultQProfileDao().insertOrUpdate(dbSession, defaultQProfileDto);
+ }
+
+ dbClient.qualityProfileDao().insert(batchDbSession, dto);
}
private void initRuleRepository(DbSession dbSession) {
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/organization/MemberUpdaterTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/organization/MemberUpdaterTest.java
index 44c288ff061..9e3a8eb2fce 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/organization/MemberUpdaterTest.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/organization/MemberUpdaterTest.java
@@ -38,7 +38,6 @@ import org.sonar.db.permission.template.PermissionTemplateDto;
import org.sonar.db.permission.template.PermissionTemplateUserDto;
import org.sonar.db.property.PropertyDto;
import org.sonar.db.property.PropertyQuery;
-import org.sonar.db.qualityprofile.QProfileDto;
import org.sonar.db.user.GroupDto;
import org.sonar.db.user.UserDto;
import org.sonar.server.es.EsTester;
@@ -261,29 +260,6 @@ public class MemberUpdaterTest {
}
@Test
- public void remove_member_removes_qprofiles_user_permission() {
- OrganizationDto organization = db.organizations().insert();
- GroupDto defaultGroup = db.users().insertDefaultGroup(organization, "Members");
- UserDto user = db.users().insertUser();
- UserDto adminUser = db.users().insertAdminByUserPermission(organization);
- db.organizations().addMember(organization, user, adminUser);
- db.users().insertMember(defaultGroup, user);
- userIndexer.indexOnStartup(new HashSet<>());
-
- OrganizationDto anotherOrganization = db.organizations().insert();
- db.organizations().addMember(anotherOrganization, user);
- QProfileDto profile = db.qualityProfiles().insert(organization);
- QProfileDto anotherProfile = db.qualityProfiles().insert(anotherOrganization);
- db.qualityProfiles().addUserPermission(profile, user);
- db.qualityProfiles().addUserPermission(anotherProfile, user);
-
- underTest.removeMember(db.getSession(), organization, user);
-
- assertThat(db.getDbClient().qProfileEditUsersDao().exists(db.getSession(), profile, user)).isFalse();
- assertThat(db.getDbClient().qProfileEditUsersDao().exists(db.getSession(), anotherProfile, user)).isTrue();
- }
-
- @Test
public void remove_member_removes_user_from_organization_groups() {
OrganizationDto organization = db.organizations().insert();
GroupDto defaultGroup = db.users().insertDefaultGroup(organization, "Members");
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/organization/OrganizationUpdaterImplTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/organization/OrganizationUpdaterImplTest.java
index ba5dee147ca..4042fb3724f 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/organization/OrganizationUpdaterImplTest.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/organization/OrganizationUpdaterImplTest.java
@@ -226,10 +226,10 @@ public class OrganizationUpdaterImplTest {
underTest.create(dbSession, user, FULL_POPULATED_NEW_ORGANIZATION, EMPTY_ORGANIZATION_CONSUMER);
OrganizationDto organization = dbClient.organizationDao().selectByKey(dbSession, FULL_POPULATED_NEW_ORGANIZATION.getKey()).get();
- List<QProfileDto> profiles = dbClient.qualityProfileDao().selectOrderedByOrganizationUuid(dbSession, organization);
+ List<QProfileDto> profiles = dbClient.qualityProfileDao().selectAll(dbSession);
assertThat(profiles).extracting(p -> new QProfileName(p.getLanguage(), p.getName())).containsExactlyInAnyOrder(
builtIn1.getQProfileName(), builtIn2.getQProfileName());
- assertThat(dbClient.qualityProfileDao().selectDefaultProfile(dbSession, organization, "foo").getName())
+ assertThat(dbClient.qualityProfileDao().selectDefaultProfile(dbSession, "foo").getName())
.isEqualTo("qp1");
}
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/qualityprofile/BuiltInQProfileInsertImplTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/qualityprofile/BuiltInQProfileInsertImplTest.java
index 1d49048f134..dd6abc61954 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/qualityprofile/BuiltInQProfileInsertImplTest.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/qualityprofile/BuiltInQProfileInsertImplTest.java
@@ -33,7 +33,6 @@ import org.sonar.core.util.SequenceUuidFactory;
import org.sonar.core.util.UuidFactory;
import org.sonar.db.DbSession;
import org.sonar.db.DbTester;
-import org.sonar.db.organization.OrganizationDto;
import org.sonar.db.qualityprofile.ActiveRuleDto;
import org.sonar.db.qualityprofile.ActiveRuleKey;
import org.sonar.db.qualityprofile.ActiveRuleParamDto;
@@ -41,7 +40,6 @@ import org.sonar.db.qualityprofile.QProfileChangeDto;
import org.sonar.db.qualityprofile.QProfileChangeQuery;
import org.sonar.db.qualityprofile.QProfileDto;
import org.sonar.db.rule.RuleDefinitionDto;
-import org.sonar.server.language.LanguageTesting;
import org.sonar.server.qualityprofile.index.ActiveRuleIndexer;
import org.sonar.server.util.TypeValidations;
@@ -54,7 +52,7 @@ public class BuiltInQProfileInsertImplTest {
@Rule
public BuiltInQProfileRepositoryRule builtInQProfileRepository = new BuiltInQProfileRepositoryRule();
@Rule
- public DbTester db = DbTester.create().setDisableDefaultOrganization(true);
+ public DbTester db = DbTester.create();
@Rule
public ExpectedException expectedException = ExpectedException.none();
@@ -72,31 +70,7 @@ public class BuiltInQProfileInsertImplTest {
}
@Test
- public void insert_single_row_in_RULES_PROFILES_and_reference_it_in_ORG_QPROFILES() {
- OrganizationDto org1 = db.organizations().insert();
- OrganizationDto org2 = db.organizations().insert();
- BuiltInQProfile builtIn = builtInQProfileRepository.create(LanguageTesting.newLanguage("xoo"), "the name", false);
-
- call(builtIn);
-
- verifyTableSize("org_qprofiles", 2);
- verifyTableSize("rules_profiles", 1);
- verifyTableSize("active_rules", 0);
- verifyTableSize("active_rule_parameters", 0);
- verifyTableSize("qprofile_changes", 0);
- verifyTableSize("project_qprofiles", 0);
-
- QProfileDto profileOnOrg1 = verifyProfileInDb(org1, builtIn);
- QProfileDto profileOnOrg2 = verifyProfileInDb(org2, builtIn);
-
- // same row in table rules_profiles is used
- assertThat(profileOnOrg1.getKee()).isNotEqualTo(profileOnOrg2.getKee());
- assertThat(profileOnOrg1.getRulesProfileUuid()).isEqualTo(profileOnOrg2.getRulesProfileUuid());
- }
-
- @Test
public void insert_active_rules_and_changelog() {
- OrganizationDto org = db.organizations().insert();
RuleDefinitionDto rule1 = db.rules().insert(r -> r.setLanguage("xoo"));
RuleDefinitionDto rule2 = db.rules().insert(r -> r.setLanguage("xoo"));
@@ -115,14 +89,13 @@ public class BuiltInQProfileInsertImplTest {
verifyTableSize("active_rule_parameters", 0);
verifyTableSize("qprofile_changes", 2);
- QProfileDto profile = verifyProfileInDb(org, builtIn);
+ QProfileDto profile = verifyProfileInDb(builtIn);
verifyActiveRuleInDb(profile, rule1, Severity.CRITICAL);
verifyActiveRuleInDb(profile, rule2, Severity.MAJOR);
}
@Test
- public void flag_profile_as_default_on_organization_if_declared_as_default_by_api() {
- OrganizationDto org = db.organizations().insert();
+ public void flag_profile_as_default_if_declared_as_default_by_api() {
BuiltInQualityProfilesDefinition.Context context = new BuiltInQualityProfilesDefinition.Context();
NewBuiltInQualityProfile newQp = context.createBuiltInQualityProfile("the name", "xoo").setDefault(true);
newQp.done();
@@ -131,31 +104,29 @@ public class BuiltInQProfileInsertImplTest {
call(builtIn);
- QProfileDto profile = verifyProfileInDb(org, builtIn);
- QProfileDto defaultProfile = db.getDbClient().qualityProfileDao().selectDefaultProfile(dbSession, org, "xoo");
+ QProfileDto profile = verifyProfileInDb(builtIn);
+ QProfileDto defaultProfile = db.getDbClient().qualityProfileDao().selectDefaultProfile(dbSession, "xoo");
assertThat(defaultProfile.getKee()).isEqualTo(profile.getKee());
}
@Test
- public void existing_default_profile_in_organization_must_not_be_changed() {
+ public void existing_default_profile_must_not_be_changed() {
BuiltInQualityProfilesDefinition.Context context = new BuiltInQualityProfilesDefinition.Context();
NewBuiltInQualityProfile newQp = context.createBuiltInQualityProfile("the name", "xoo").setDefault(true);
newQp.done();
BuiltInQProfile builtIn = builtInQProfileRepository.create(context.profile("xoo", "the name"));
- OrganizationDto org = db.organizations().insert();
- QProfileDto currentDefault = db.qualityProfiles().insert(org, p -> p.setLanguage("xoo"));
+ QProfileDto currentDefault = db.qualityProfiles().insert(p -> p.setLanguage("xoo"));
db.qualityProfiles().setAsDefault(currentDefault);
call(builtIn);
- QProfileDto defaultProfile = db.getDbClient().qualityProfileDao().selectDefaultProfile(dbSession, org, "xoo");
+ QProfileDto defaultProfile = db.getDbClient().qualityProfileDao().selectDefaultProfile(dbSession, "xoo");
assertThat(defaultProfile.getKee()).isEqualTo(currentDefault.getKee());
}
@Test
- public void dont_flag_profile_as_default_on_organization_if_not_declared_as_default_by_api() {
- OrganizationDto org = db.organizations().insert();
+ public void dont_flag_profile_as_default_if_not_declared_as_default_by_api() {
BuiltInQualityProfilesDefinition.Context context = new BuiltInQualityProfilesDefinition.Context();
NewBuiltInQualityProfile newQp = context.createBuiltInQualityProfile("the name", "xoo").setDefault(false);
newQp.done();
@@ -163,7 +134,7 @@ public class BuiltInQProfileInsertImplTest {
call(builtIn);
- QProfileDto defaultProfile = db.getDbClient().qualityProfileDao().selectDefaultProfile(dbSession, org, "xoo");
+ QProfileDto defaultProfile = db.getDbClient().qualityProfileDao().selectDefaultProfile(dbSession, "xoo");
assertThat(defaultProfile).isNull();
}
@@ -197,11 +168,10 @@ public class BuiltInQProfileInsertImplTest {
assertThat(change.getDataAsMap().get("severity")).isEqualTo(expectedSeverity);
}
- private QProfileDto verifyProfileInDb(OrganizationDto organization, BuiltInQProfile builtIn) {
- QProfileDto profileOnOrg1 = db.getDbClient().qualityProfileDao().selectByNameAndLanguage(dbSession, organization, builtIn.getName(), builtIn.getLanguage());
+ private QProfileDto verifyProfileInDb(BuiltInQProfile builtIn) {
+ QProfileDto profileOnOrg1 = db.getDbClient().qualityProfileDao().selectByNameAndLanguage(dbSession, builtIn.getName(), builtIn.getLanguage());
assertThat(profileOnOrg1.getLanguage()).isEqualTo(builtIn.getLanguage());
assertThat(profileOnOrg1.getName()).isEqualTo(builtIn.getName());
- assertThat(profileOnOrg1.getOrganizationUuid()).isEqualTo(organization.getUuid());
assertThat(profileOnOrg1.getParentKee()).isNull();
assertThat(profileOnOrg1.getLastUsed()).isNull();
assertThat(profileOnOrg1.getUserUpdatedAt()).isNull();
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/qualityprofile/BuiltInQProfileUpdateImplTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/qualityprofile/BuiltInQProfileUpdateImplTest.java
index 09741edd18c..4d64f56da08 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/qualityprofile/BuiltInQProfileUpdateImplTest.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/qualityprofile/BuiltInQProfileUpdateImplTest.java
@@ -255,8 +255,7 @@ public class BuiltInQProfileUpdateImplTest {
public void propagate_activation_to_descendant_profiles() {
RuleDefinitionDto rule = db.rules().insert(r -> r.setLanguage("xoo"));
- QProfileDto profile = db.qualityProfiles().insert(db.getDefaultOrganization(),
- p -> p.setLanguage(rule.getLanguage()).setIsBuiltIn(true));
+ QProfileDto profile = db.qualityProfiles().insert(p -> p.setLanguage(rule.getLanguage()).setIsBuiltIn(true));
QProfileDto childProfile = createChildProfile(profile);
QProfileDto grandchildProfile = createChildProfile(childProfile);
@@ -277,8 +276,7 @@ public class BuiltInQProfileUpdateImplTest {
public void do_not_load_descendants_if_no_changes() {
RuleDefinitionDto rule = db.rules().insert(r -> r.setLanguage("xoo"));
- QProfileDto profile = db.qualityProfiles().insert(db.getDefaultOrganization(),
- p -> p.setLanguage(rule.getLanguage()).setIsBuiltIn(true));
+ QProfileDto profile = db.qualityProfiles().insert(p -> p.setLanguage(rule.getLanguage()).setIsBuiltIn(true));
QProfileDto childProfile = createChildProfile(profile);
BuiltInQualityProfilesDefinition.Context context = new BuiltInQualityProfilesDefinition.Context();
@@ -308,8 +306,7 @@ public class BuiltInQProfileUpdateImplTest {
public void propagate_deactivation_to_descendant_profiles() {
RuleDefinitionDto rule = db.rules().insert(r -> r.setLanguage("xoo"));
- QProfileDto profile = db.qualityProfiles().insert(db.getDefaultOrganization(),
- p -> p.setLanguage(rule.getLanguage()).setIsBuiltIn(true));
+ QProfileDto profile = db.qualityProfiles().insert(p -> p.setLanguage(rule.getLanguage()).setIsBuiltIn(true));
QProfileDto childProfile = createChildProfile(profile);
QProfileDto grandChildProfile = createChildProfile(childProfile);
@@ -337,7 +334,7 @@ public class BuiltInQProfileUpdateImplTest {
}
private QProfileDto createChildProfile(QProfileDto parent) {
- return db.qualityProfiles().insert(db.getDefaultOrganization(), p -> p
+ return db.qualityProfiles().insert(p -> p
.setLanguage(parent.getLanguage())
.setParentKee(parent.getKee())
.setName("Child of " + parent.getName()))