Skip to content

Commit

Permalink
SONAR-9305 Built-in quality profiles should be updated automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Brandhof authored and ehartmann committed Jun 14, 2017
1 parent dd57132 commit bce59a8
Show file tree
Hide file tree
Showing 37 changed files with 1,195 additions and 574 deletions.
Expand Up @@ -46,6 +46,7 @@
import util.QualityProfileSupport; import util.QualityProfileSupport;
import util.user.UserRule; import util.user.UserRule;


import static org.apache.commons.lang3.RandomStringUtils.randomAlphanumeric;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static util.ItUtils.expectForbiddenError; import static util.ItUtils.expectForbiddenError;
import static util.ItUtils.expectMissingError; import static util.ItUtils.expectMissingError;
Expand Down Expand Up @@ -254,14 +255,15 @@ public void analysis_must_use_default_profile() {


QualityProfileSupport adminProfiles = profiles.as(user.getLogin(), A_PASSWORD); QualityProfileSupport adminProfiles = profiles.as(user.getLogin(), A_PASSWORD);


String projectKey = "test-project"; String projectKey = randomAlphanumeric(10);
String projectName = randomAlphanumeric(10);
orchestrator.executeBuild( orchestrator.executeBuild(
SonarScanner.create(projectDir("shared/xoo-sample"), SonarScanner.create(projectDir("shared/xoo-sample"),
"sonar.login", user.getLogin(), "sonar.login", user.getLogin(),
"sonar.password", A_PASSWORD, "sonar.password", A_PASSWORD,
"sonar.organization", org.getKey()) "sonar.organization", org.getKey())
.setProjectKey(projectKey) .setProjectKey(projectKey)
.setProjectName("my-project") .setProjectName(projectName)
); );


QualityProfiles.SearchWsResponse.QualityProfile defaultProfile = getProfile(org, p -> "xoo".equals(p.getLanguage()) && p.getIsDefault()); QualityProfiles.SearchWsResponse.QualityProfile defaultProfile = getProfile(org, p -> "xoo".equals(p.getLanguage()) && p.getIsDefault());
Expand All @@ -276,7 +278,7 @@ public void analysis_must_use_default_profile() {
"sonar.password", A_PASSWORD, "sonar.password", A_PASSWORD,
"sonar.organization", org.getKey()) "sonar.organization", org.getKey())
.setProjectKey(projectKey) .setProjectKey(projectKey)
.setProjectName("my-project") .setProjectName(projectName)
); );


assertThatQualityProfileIsUsedFor(projectKey, newXooProfile.getKey()); assertThatQualityProfileIsUsedFor(projectKey, newXooProfile.getKey());
Expand All @@ -286,8 +288,8 @@ public void analysis_must_use_default_profile() {
public void analysis_must_use_associated_profile() { public void analysis_must_use_associated_profile() {
Organization org = organizations.create(); Organization org = organizations.create();
User user = users.createAdministrator(org, A_PASSWORD); User user = users.createAdministrator(org, A_PASSWORD);
String projectKey = "test-project"; String projectKey = randomAlphanumeric(10);
String projectName = "my-project"; String projectName = randomAlphanumeric(10);
QualityProfileSupport adminProfiles = profiles.as(user.getLogin(), A_PASSWORD); QualityProfileSupport adminProfiles = profiles.as(user.getLogin(), A_PASSWORD);
QualityProfile newXooProfile = adminProfiles.createXooProfile(org); QualityProfile newXooProfile = adminProfiles.createXooProfile(org);


Expand Down
Expand Up @@ -71,6 +71,10 @@ public List<OrgActiveRuleDto> selectByProfile(DbSession dbSession, QProfileDto p
return selectByProfileUuid(dbSession, profile.getKee()); return selectByProfileUuid(dbSession, profile.getKee());
} }


public List<ActiveRuleDto> selectByRuleProfile(DbSession dbSession, RulesProfileDto ruleProfileDto) {
return mapper(dbSession).selectByRuleProfileUuid(ruleProfileDto.getKee());
}

public ActiveRuleDto insert(DbSession dbSession, ActiveRuleDto item) { public ActiveRuleDto insert(DbSession dbSession, ActiveRuleDto item) {
Preconditions.checkArgument(item.getProfileId() != null, QUALITY_PROFILE_IS_NOT_PERSISTED); Preconditions.checkArgument(item.getProfileId() != null, QUALITY_PROFILE_IS_NOT_PERSISTED);
Preconditions.checkArgument(item.getRuleId() != null, RULE_IS_NOT_PERSISTED); Preconditions.checkArgument(item.getRuleId() != null, RULE_IS_NOT_PERSISTED);
Expand Down Expand Up @@ -101,6 +105,11 @@ public void deleteByRuleProfileUuids(DbSession dbSession, Collection<String> rul
DatabaseUtils.executeLargeUpdates(rulesProfileUuids, mapper::deleteByRuleProfileUuids); DatabaseUtils.executeLargeUpdates(rulesProfileUuids, mapper::deleteByRuleProfileUuids);
} }


public void deleteByIds(DbSession dbSession, List<Integer> activeRuleIds) {
ActiveRuleMapper mapper = mapper(dbSession);
DatabaseUtils.executeLargeUpdates(activeRuleIds, mapper::deleteByIds);
}

public void deleteParametersByRuleProfileUuids(DbSession dbSession, Collection<String> rulesProfileUuids) { public void deleteParametersByRuleProfileUuids(DbSession dbSession, Collection<String> rulesProfileUuids) {
ActiveRuleMapper mapper = mapper(dbSession); ActiveRuleMapper mapper = mapper(dbSession);
DatabaseUtils.executeLargeUpdates(rulesProfileUuids, mapper::deleteParametersByRuleProfileUuids); DatabaseUtils.executeLargeUpdates(rulesProfileUuids, mapper::deleteParametersByRuleProfileUuids);
Expand Down Expand Up @@ -152,6 +161,11 @@ public void deleteParamsByRuleParamOfAllOrganizations(DbSession dbSession, RuleP
} }
} }


public void deleteParamsByActiveRuleIds(DbSession dbSession, List<Integer> activeRuleIds) {
ActiveRuleMapper mapper = mapper(dbSession);
DatabaseUtils.executeLargeUpdates(activeRuleIds, mapper::deleteParamsByActiveRuleIds);
}

/** /**
* Active rule on removed rule are NOT taken into account * Active rule on removed rule are NOT taken into account
*/ */
Expand All @@ -176,5 +190,4 @@ public Map<String, Long> countActiveRulesForInheritanceByProfileUuid(DbSession d
private static ActiveRuleMapper mapper(DbSession dbSession) { private static ActiveRuleMapper mapper(DbSession dbSession) {
return dbSession.getMapper(ActiveRuleMapper.class); return dbSession.getMapper(ActiveRuleMapper.class);
} }

} }
Expand Up @@ -36,6 +36,8 @@ public interface ActiveRuleMapper {


void deleteByRuleProfileUuids(@Param("rulesProfileUuids") Collection<String> rulesProfileUuids); void deleteByRuleProfileUuids(@Param("rulesProfileUuids") Collection<String> rulesProfileUuids);


void deleteByIds(@Param("ids") Collection<Integer> ids);

@CheckForNull @CheckForNull
ActiveRuleDto selectByKey(@Param("ruleProfileUuid") String ruleProfileUuid, @Param("repository") String repository, @Param("rule") String rule); ActiveRuleDto selectByKey(@Param("ruleProfileUuid") String ruleProfileUuid, @Param("repository") String repository, @Param("rule") String rule);


Expand All @@ -49,6 +51,8 @@ public interface ActiveRuleMapper {


List<OrgActiveRuleDto> selectByProfileUuid(String uuid); List<OrgActiveRuleDto> selectByProfileUuid(String uuid);


List<ActiveRuleDto> selectByRuleProfileUuid(@Param("ruleProfileUuid") String uuid);

void insertParameter(ActiveRuleParamDto dto); void insertParameter(ActiveRuleParamDto dto);


void updateParameter(ActiveRuleParamDto dto); void updateParameter(ActiveRuleParamDto dto);
Expand All @@ -59,6 +63,8 @@ public interface ActiveRuleMapper {


void deleteParameter(int activeRuleParamId); void deleteParameter(int activeRuleParamId);


void deleteParamsByActiveRuleIds(@Param("activeRuleIds") Collection<Integer> activeRuleIds);

List<ActiveRuleParamDto> selectParamsByActiveRuleId(int activeRuleId); List<ActiveRuleParamDto> selectParamsByActiveRuleId(int activeRuleId);


List<ActiveRuleParamDto> selectParamsByActiveRuleIds(@Param("ids") List<Integer> ids); List<ActiveRuleParamDto> selectParamsByActiveRuleIds(@Param("ids") List<Integer> ids);
Expand Down
Expand Up @@ -109,9 +109,15 @@ public void update(DbSession dbSession, QProfileDto profile, QProfileDto... othe
} }
} }


public void update(DbSession dbSession, RulesProfileDto rulesProfile) {
QualityProfileMapper mapper = mapper(dbSession);
long now = system.now();
mapper.updateRuleProfile(rulesProfile, new Date(now));
}

private void doUpdate(QualityProfileMapper mapper, QProfileDto profile, long now) { private void doUpdate(QualityProfileMapper mapper, QProfileDto profile, long now) {
mapper.updateRuleProfile(profile, new Date(now)); mapper.updateRuleProfile(RulesProfileDto.from(profile), new Date(now));
mapper.updateOrgQProfile(profile, now); mapper.updateOrgQProfile(OrgQProfileDto.from(profile), now);
} }


public List<QProfileDto> selectDefaultProfiles(DbSession dbSession, OrganizationDto organization, Collection<String> languages) { public List<QProfileDto> selectDefaultProfiles(DbSession dbSession, OrganizationDto organization, Collection<String> languages) {
Expand Down Expand Up @@ -220,6 +226,10 @@ public void deleteRulesProfilesByUuids(DbSession dbSession, Collection<String> r
DatabaseUtils.executeLargeUpdates(rulesProfileUuids, mapper::deleteRuleProfilesByUuids); DatabaseUtils.executeLargeUpdates(rulesProfileUuids, mapper::deleteRuleProfilesByUuids);
} }


public List<QProfileDto> selectChildrenOfBuiltInRulesProfile(DbSession dbSession, RulesProfileDto rulesProfile) {
return mapper(dbSession).selectChildrenOfBuiltInRulesProfile(rulesProfile.getKee());
}

private static String sqlQueryString(@Nullable String query) { private static String sqlQueryString(@Nullable String query) {
if (query == null) { if (query == null) {
return "%"; return "%";
Expand Down
Expand Up @@ -32,9 +32,9 @@ public interface QualityProfileMapper {


void insertRuleProfile(@Param("dto") RulesProfileDto dto, @Param("now") Date now); void insertRuleProfile(@Param("dto") RulesProfileDto dto, @Param("now") Date now);


void updateRuleProfile(@Param("dto") QProfileDto dto, @Param("now") Date now); void updateRuleProfile(@Param("dto") RulesProfileDto dto, @Param("now") Date now);


void updateOrgQProfile(@Param("dto") QProfileDto dto, @Param("now") long now); void updateOrgQProfile(@Param("dto") OrgQProfileDto dto, @Param("now") long now);


void deleteRuleProfilesByUuids(@Param("uuids") Collection<String> uuids); void deleteRuleProfilesByUuids(@Param("uuids") Collection<String> uuids);


Expand Down Expand Up @@ -121,4 +121,6 @@ List<ProjectQprofileAssociationDto> selectProjectAssociations(
List<String> selectUuidsOfCustomRuleProfiles(@Param("language") String language, @Param("name") String name); List<String> selectUuidsOfCustomRuleProfiles(@Param("language") String language, @Param("name") String name);


void renameRuleProfiles(@Param("newName") String newName, @Param("updatedAt") Date updatedAt, @Param("uuids") Collection<String> uuids); void renameRuleProfiles(@Param("newName") String newName, @Param("updatedAt") Date updatedAt, @Param("uuids") Collection<String> uuids);

List<QProfileDto> selectChildrenOfBuiltInRulesProfile(@Param("rulesProfileUuid") String rulesProfileUuid);
} }
Expand Up @@ -81,6 +81,13 @@
) )
</delete> </delete>


<delete id="deleteByIds" parameterType="Integer">
delete from active_rules
where
id in
<foreach collection="ids" open="(" close=")" item="id" separator=",">#{id, jdbcType=INTEGER}</foreach>
</delete>

<select id="selectByKey" parameterType="map" resultType="ActiveRule"> <select id="selectByKey" parameterType="map" resultType="ActiveRule">
select select
<include refid="activeRuleColumns"/> <include refid="activeRuleColumns"/>
Expand Down Expand Up @@ -116,6 +123,15 @@
where oqp.uuid = #{id, jdbcType=VARCHAR} where oqp.uuid = #{id, jdbcType=VARCHAR}
</select> </select>


<select id="selectByRuleProfileUuid" parameterType="string" resultType="org.sonar.db.qualityprofile.ActiveRuleDto">
select
<include refid="activeRuleColumns"/>
from active_rules a
<include refid="activeRuleKeyJoin"/>
where
rp.kee = #{ruleProfileUuid, jdbcType=VARCHAR}
</select>

<select id="selectByRuleId" parameterType="map" resultType="org.sonar.db.qualityprofile.OrgActiveRuleDto"> <select id="selectByRuleId" parameterType="map" resultType="org.sonar.db.qualityprofile.OrgActiveRuleDto">
select select
<include refid="orgActiveRuleColumns"/> <include refid="orgActiveRuleColumns"/>
Expand Down Expand Up @@ -203,6 +219,13 @@
DELETE FROM active_rule_parameters WHERE id=#{id, jdbcType=BIGINT} DELETE FROM active_rule_parameters WHERE id=#{id, jdbcType=BIGINT}
</delete> </delete>


<delete id="deleteParamsByActiveRuleIds" parameterType="Integer">
delete from active_rule_parameters
where
active_rule_id in
<foreach collection="activeRuleIds" open="(" close=")" item="activeRuleId" separator=",">#{activeRuleId, jdbcType=INTEGER}</foreach>
</delete>

<select id="selectParamsByActiveRuleId" parameterType="Integer" resultType="ActiveRuleParam"> <select id="selectParamsByActiveRuleId" parameterType="Integer" resultType="ActiveRuleParam">
select select
<include refid="activeRuleParamColumns"/> <include refid="activeRuleParamColumns"/>
Expand Down
Expand Up @@ -77,18 +77,18 @@
rules_updated_at = #{dto.rulesUpdatedAt, jdbcType=VARCHAR}, rules_updated_at = #{dto.rulesUpdatedAt, jdbcType=VARCHAR},
is_built_in = #{dto.isBuiltIn, jdbcType=BOOLEAN} is_built_in = #{dto.isBuiltIn, jdbcType=BOOLEAN}
where where
kee = #{dto.rulesProfileUuid, jdbcType=VARCHAR} kee = #{dto.kee, jdbcType=VARCHAR}
</update> </update>


<update id="updateOrgQProfile" parameterType="map"> <update id="updateOrgQProfile" parameterType="map">
update org_qprofiles update org_qprofiles
set set
parent_uuid = #{dto.parentKee, jdbcType=VARCHAR}, parent_uuid = #{dto.parentUuid, jdbcType=VARCHAR},
last_used = #{dto.lastUsed, jdbcType=BIGINT}, last_used = #{dto.lastUsed, jdbcType=BIGINT},
user_updated_at = #{dto.userUpdatedAt, jdbcType=BIGINT}, user_updated_at = #{dto.userUpdatedAt, jdbcType=BIGINT},
updated_at = #{now, jdbcType=BIGINT} updated_at = #{now, jdbcType=BIGINT}
where where
uuid = #{dto.kee, jdbcType=VARCHAR} uuid = #{dto.uuid, jdbcType=VARCHAR}
</update> </update>


<delete id="deleteRuleProfilesByUuids" parameterType="String"> <delete id="deleteRuleProfilesByUuids" parameterType="String">
Expand Down Expand Up @@ -335,5 +335,18 @@
where where
kee in <foreach collection="uuids" open="(" close=")" item="uuid" separator=",">#{uuid, jdbcType=VARCHAR}</foreach> kee in <foreach collection="uuids" open="(" close=")" item="uuid" separator=",">#{uuid, jdbcType=VARCHAR}</foreach>
</update> </update>

<select id="selectChildrenOfBuiltInRulesProfile" parameterType="string" resultType="org.sonar.db.qualityprofile.QProfileDto">
select
<include refid="qProfileColumns"/>
from org_qprofiles oqp
inner join rules_profiles rp on oqp.rules_profile_uuid = rp.kee
inner join org_qprofiles parentoqp on parentoqp.uuid = oqp.parent_uuid
inner join rules_profiles parentrp on parentoqp.rules_profile_uuid = parentrp.kee
where
parentrp.kee = #{rulesProfileUuid, jdbcType=VARCHAR}
and parentrp.is_built_in = ${_true}
and oqp.parent_uuid is not null
</select>
</mapper> </mapper>


Expand Up @@ -151,13 +151,29 @@ public void selectByProfile() {
} }


@Test @Test
public void selectByProfileUuid_ignores_removed_rules() throws Exception { public void selectByProfileUuid_ignores_removed_rules() {
ActiveRuleDto activeRule = createFor(profile1, removedRule).setSeverity(BLOCKER); ActiveRuleDto activeRule = createFor(profile1, removedRule).setSeverity(BLOCKER);
underTest.insert(dbSession, activeRule); underTest.insert(dbSession, activeRule);


assertThat(underTest.selectByProfile(dbSession, profile1)).isEmpty(); assertThat(underTest.selectByProfile(dbSession, profile1)).isEmpty();
} }


@Test
public void selectByRuleProfileUuid() {
ActiveRuleDto activeRule1 = createFor(profile1, rule1).setSeverity(BLOCKER);
ActiveRuleDto activeRule2 = createFor(profile1, rule2).setSeverity(MAJOR);
underTest.insert(dbSession, activeRule1);
underTest.insert(dbSession, activeRule2);

List<ActiveRuleDto> result = underTest.selectByRuleProfile(dbSession, RulesProfileDto.from(profile1));
assertThat(result)
.hasSize(2)
.extracting(ActiveRuleDto::getProfileId, ActiveRuleDto::getRuleKey, ActiveRuleDto::getSeverityString)
.containsOnly(tuple(profile1.getId(), rule1.getKey(), BLOCKER), tuple(profile1.getId(), rule2.getKey(), MAJOR));

assertThat(underTest.selectByProfile(dbSession, profile2)).isEmpty();
}

@Test @Test
public void insert() { public void insert() {
ActiveRuleDto activeRule = createFor(profile1, rule1) ActiveRuleDto activeRule = createFor(profile1, rule1)
Expand Down Expand Up @@ -297,6 +313,29 @@ public void deleteByRuleProfileUuids_does_not_fail_when_rules_profile_with_speci
assertThat(db.countRowsOfTable(dbSession, "active_rules")).isEqualTo(1); assertThat(db.countRowsOfTable(dbSession, "active_rules")).isEqualTo(1);
} }


@Test
public void deleteByIds() {
ActiveRuleDto ar1 = underTest.insert(dbSession, newRow(profile1, rule1));
ActiveRuleDto ar2 = underTest.insert(dbSession, newRow(profile1, rule2));
ActiveRuleDto ar3 = underTest.insert(dbSession, newRow(profile2, rule1));

underTest.deleteByIds(dbSession, asList(ar1.getId(), ar3.getId()));

assertThat(db.countRowsOfTable(dbSession, "active_rules")).isEqualTo(1);
assertThat(underTest.selectByProfile(dbSession, profile1))
.extracting(ActiveRuleDto::getId)
.containsExactly(ar2.getId());
}

@Test
public void deleteByIds_does_nothing_if_empty_list_of_ids() {
underTest.insert(dbSession, newRow(profile1, rule1));

underTest.deleteByIds(dbSession, emptyList());

assertThat(db.countRowsOfTable(dbSession, "active_rules")).isEqualTo(1);
}

private static ActiveRuleDto newRow(QProfileDto profile, RuleDefinitionDto rule) { private static ActiveRuleDto newRow(QProfileDto profile, RuleDefinitionDto rule) {
return createFor(profile, rule).setSeverity(BLOCKER); return createFor(profile, rule).setSeverity(BLOCKER);
} }
Expand Down Expand Up @@ -460,6 +499,22 @@ public void deleteParamsByRuleParamOfAllOrganizations() {
assertThat(underTest.selectParamsByActiveRuleIds(dbSession, activeRuleIds)).isEmpty(); assertThat(underTest.selectParamsByActiveRuleIds(dbSession, activeRuleIds)).isEmpty();
} }


@Test
public void deleteParamsByActiveRuleIds() {
ActiveRuleDto ar1 = underTest.insert(dbSession, newRow(profile1, rule1));
ActiveRuleParamDto param = ActiveRuleParamDto.createFor(rule1Param1).setValue("foo");
underTest.insertParam(dbSession, ar1, param);

ActiveRuleDto ar2 = underTest.insert(dbSession, newRow(profile1, rule2));
ActiveRuleParamDto param2 = ActiveRuleParamDto.createFor(rule2Param1).setValue("bar");
underTest.insertParam(dbSession, ar2, param2);

underTest.deleteParamsByActiveRuleIds(dbSession, asList(ar1.getId()));

assertThat(underTest.selectParamsByActiveRuleId(dbSession, ar1.getId())).hasSize(0);
assertThat(underTest.selectParamsByActiveRuleId(dbSession, ar2.getId())).hasSize(1);
}

@Test @Test
public void test_countActiveRulesByProfileKey_for_a_specified_organization() { public void test_countActiveRulesByProfileKey_for_a_specified_organization() {
db.qualityProfiles().activateRule(profile1, rule1); db.qualityProfiles().activateRule(profile1, rule1);
Expand Down
Expand Up @@ -49,7 +49,9 @@
import static org.assertj.core.api.Assertions.tuple; import static org.assertj.core.api.Assertions.tuple;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import static org.sonar.core.util.stream.MoreCollectors.toList;
import static org.sonar.db.qualityprofile.QualityProfileTesting.newQualityProfileDto; import static org.sonar.db.qualityprofile.QualityProfileTesting.newQualityProfileDto;
import static org.sonar.db.qualityprofile.RulesProfileDto.from;


public class QualityProfileDaoTest { public class QualityProfileDaoTest {


Expand Down Expand Up @@ -721,4 +723,35 @@ private List<QProfileDto> createSharedData() {
return Arrays.asList(dto1, dto2); return Arrays.asList(dto1, dto2);
} }


@Test
public void selectChildrenOfBuiltInRulesProfile_must_return_only_inherited_profiles() {
OrganizationDto org1 = db.organizations().insert();
OrganizationDto org2 = db.organizations().insert();
OrganizationDto org3 = db.organizations().insert();

QProfileDto builtInProfile = db.qualityProfiles().insert(org1, p -> p.setIsBuiltIn(true).setLanguage("java").setName("foo"));
QProfileDto javaProfileOrg2 = db.qualityProfiles().insert(org2, p -> p.setIsBuiltIn(false).setLanguage("java").setName("foo"));
QProfileDto inheritedJavaProfileOrg2 = db.qualityProfiles().insert(org2, p -> p.setIsBuiltIn(false).setLanguage("java").setName("foo").setParentKee(builtInProfile.getKee()));
QProfileDto differentLanguage = db.qualityProfiles().insert(org2, p -> p.setIsBuiltIn(false).setLanguage("cobol").setName("foo"));
QProfileDto differentName = db.qualityProfiles().insert(org2, p -> p.setIsBuiltIn(false).setLanguage("java").setName("bar"));
QProfileDto javaProfileOrg3 = db.qualityProfiles().insert(org3, p -> p.setIsBuiltIn(false).setLanguage("java").setName("foo"));
QProfileDto inheritedJavaProfileOrg3 = db.qualityProfiles().insert(org3, p -> p.setIsBuiltIn(false).setLanguage("java").setName("foo").setParentKee(builtInProfile.getKee()));

List<QProfileDto> children = db.getDbClient().qualityProfileDao().selectChildrenOfBuiltInRulesProfile(db.getSession(), from(builtInProfile));

assertThat(children.stream().map(qp -> qp.getId()).collect(toList())).containsExactlyInAnyOrder(
inheritedJavaProfileOrg2.getId(), inheritedJavaProfileOrg3.getId());
}

@Test
public void selectChildrenOfBuiltInRulesProfile_must_return_empty_list_if_not_built_in() {
OrganizationDto org = db.organizations().insert();

QProfileDto notBuiltInProfile = db.qualityProfiles().insert(org, p -> p.setIsBuiltIn(false).setLanguage("java").setName("foo"));
QProfileDto inheritedProfile = db.qualityProfiles().insert(org, p -> p.setIsBuiltIn(false).setLanguage("java").setName("foo").setParentKee(notBuiltInProfile.getKee()));

List<QProfileDto> children = db.getDbClient().qualityProfileDao().selectChildrenOfBuiltInRulesProfile(db.getSession(), from(notBuiltInProfile));

assertThat(children).isEmpty();
}
} }

0 comments on commit bce59a8

Please sign in to comment.