Search in sources :

Example 6 with QProfileChangeQuery

use of org.sonar.db.qualityprofile.QProfileChangeQuery in project sonarqube by SonarSource.

the class ChangelogLoaderTest method return_change_with_only_required_fields.

@Test
public void return_change_with_only_required_fields() {
    insertChange("C1", ActiveRuleChange.Type.ACTIVATED, A_DATE, null, null);
    QProfileChangeQuery query = new QProfileChangeQuery(A_PROFILE_KEY);
    ChangelogLoader.Change change = underTest.load(dbSession, query).getChanges().get(0);
    assertThat(change.getKey()).isEqualTo("C1");
    assertThat(change.getCreatedAt()).isEqualTo(A_DATE);
    assertThat(change.getType()).isEqualTo(ActiveRuleChange.Type.ACTIVATED.name());
    // optional fields are null or empty
    assertThat(change.getInheritance()).isNull();
    assertThat(change.getRuleKey()).isNull();
    assertThat(change.getRuleName()).isNull();
    assertThat(change.getSeverity()).isNull();
    assertThat(change.getUserLogin()).isNull();
    assertThat(change.getUserName()).isNull();
    assertThat(change.getParams()).isEmpty();
}
Also used : QProfileChangeQuery(org.sonar.db.qualityprofile.QProfileChangeQuery) Test(org.junit.Test)

Example 7 with QProfileChangeQuery

use of org.sonar.db.qualityprofile.QProfileChangeQuery in project sonarqube by SonarSource.

the class ChangelogLoaderTest method return_empty_changelog.

@Test
public void return_empty_changelog() {
    QProfileChangeQuery query = new QProfileChangeQuery("P1");
    ChangelogLoader.Changelog changelog = underTest.load(dbSession, query);
    assertThat(changelog.getTotal()).isEqualTo(0);
    assertThat(changelog.getChanges()).isEmpty();
}
Also used : QProfileChangeQuery(org.sonar.db.qualityprofile.QProfileChangeQuery) Test(org.junit.Test)

Aggregations

QProfileChangeQuery (org.sonar.db.qualityprofile.QProfileChangeQuery)7 Test (org.junit.Test)6 Date (java.util.Date)1 DbSession (org.sonar.db.DbSession)1 QualityProfileDto (org.sonar.db.qualityprofile.QualityProfileDto)1