762c9190c6
@@ -24,6 +24,7 @@ import java.util.HashMap; | |||
import java.util.Map; | |||
import javax.annotation.CheckForNull; | |||
import javax.annotation.Nullable; | |||
import org.apache.commons.lang.StringUtils; | |||
import org.sonar.db.qualityprofile.ActiveRuleDto; | |||
import org.sonar.db.qualityprofile.ActiveRuleKey; | |||
import org.sonar.db.qualityprofile.QProfileChangeDto; | |||
@@ -130,6 +131,9 @@ public class ActiveRuleChange { | |||
.filter(param -> !param.getKey().isEmpty()) | |||
.forEach(param -> data.put("param_" + param.getKey(), param.getValue())); | |||
if (StringUtils.isNotEmpty(severity)) { | |||
data.put("severity", severity); | |||
} | |||
dto.setData(data); | |||
return dto; | |||
} |
@@ -97,7 +97,7 @@ public class QProfileRulesImplIT { | |||
assertThat(db.getDbClient().qProfileChangeDao().selectByQuery(db.getSession(), new QProfileChangeQuery(qProfile.getKee()))) | |||
.extracting(QProfileChangeDto::getUserUuid, QProfileChangeDto::getDataAsMap) | |||
.containsExactlyInAnyOrder(tuple(user.getUuid(), ImmutableMap.of("ruleUuid", rule.getUuid()))); | |||
.containsExactlyInAnyOrder(tuple(user.getUuid(), ImmutableMap.of("ruleUuid", rule.getUuid(), "severity", Severity.CRITICAL))); | |||
verify(qualityProfileChangeEventService).distributeRuleChangeEvent(any(), any(), eq(qProfile.getLanguage())); | |||
} | |||
} |
@@ -221,6 +221,7 @@ public class BuiltInQProfileInsertImplIT { | |||
assertThat(change.getUuid()).isNotEmpty(); | |||
assertThat(change.getUserUuid()).isNull(); | |||
assertThat(change.getRulesProfileUuid()).isEqualTo(profile.getRulesProfileUuid()); | |||
assertThat(change.getDataAsMap()).containsEntry("severity", expectedSeverity); | |||
assertThat(change.getSqVersion()).isEqualTo(sonarQubeVersion.toString()); | |||
} | |||