use of org.sonar.db.qualityprofile.QProfileChangeDto in project sonarqube by SonarSource.
the class ActiveRuleChange method toDto.
public QProfileChangeDto toDto(@Nullable String login) {
QProfileChangeDto dto = new QProfileChangeDto();
dto.setChangeType(type.name());
dto.setProfileKey(getKey().qProfile());
dto.setLogin(login);
Map<String, String> data = new HashMap<>();
data.put("key", getKey().toString());
data.put("ruleKey", getKey().ruleKey().toString());
parameters.entrySet().stream().filter(param -> !param.getKey().isEmpty()).forEach(param -> data.put("param_" + param.getKey(), param.getValue()));
if (StringUtils.isNotEmpty(severity)) {
data.put("severity", severity);
}
if (inheritance != null) {
data.put("inheritance", inheritance.name());
}
dto.setData(data);
return dto;
}
use of org.sonar.db.qualityprofile.QProfileChangeDto in project sonarqube by SonarSource.
the class ActiveRuleChangeTest method to_dto.
@Test
public void to_dto() {
QProfileChangeDto result = underTest.toDto(MY_LOGIN);
assertThat(result.getChangeType()).isEqualTo(ACTIVATED.name());
assertThat(result.getProfileKey()).isEqualTo("QP1");
assertThat(result.getLogin()).isEqualTo(MY_LOGIN);
}
use of org.sonar.db.qualityprofile.QProfileChangeDto in project sonarqube by SonarSource.
the class ChangelogLoaderTest method insertChange.
private void insertChange(String key, ActiveRuleChange.Type type, long date, @Nullable String login, @Nullable Map<String, String> data) {
QProfileChangeDto dto = QualityProfileTesting.newQProfileChangeDto().setProfileKey(A_PROFILE_KEY).setKey(key).setCreatedAt(date).setLogin(login).setChangeType(type.name()).setData(data);
QualityProfileTesting.insert(dbTester, dto);
}
Aggregations