use of org.sonar.server.qualityprofile.QualityProfile in project sonarqube by SonarSource.
the class ComputeQProfileMeasureStepTest method add_quality_profile_measure_on_project.
@Test
public void add_quality_profile_measure_on_project() {
treeRootHolder.setRoot(MULTI_MODULE_PROJECT);
QualityProfile qpJava = createQProfile(QP_NAME_1, LANGUAGE_KEY_1);
QualityProfile qpPhp = createQProfile(QP_NAME_2, LANGUAGE_KEY_2);
analysisMetadataHolder.setQProfilesByLanguage(ImmutableMap.of(LANGUAGE_KEY_1, qpJava, LANGUAGE_KEY_2, qpPhp));
underTest.execute(new TestComputationStepContext());
assertThat(measureRepository.getAddedRawMeasures(PROJECT_REF).get(QUALITY_PROFILES_KEY)).extracting("data").isEqualTo(toJson(qpJava, qpPhp));
}
use of org.sonar.server.qualityprofile.QualityProfile in project sonarqube by SonarSource.
the class RegisterQualityProfileStatusStepTest method register_added_profile.
@Test
public void register_added_profile() {
QualityProfile qp1 = qp(QP_NAME_1, LANGUAGE_KEY_1, new Date(1000L));
QualityProfile qp2 = qp(QP_NAME_2, LANGUAGE_KEY_2, new Date(1000L));
mockBaseQPMeasures(treeRootHolder.getRoot(), arrayOf(qp1));
mockRawQProfiles(ImmutableList.of(qp1, qp2));
underTest.execute(new TestComputationStepContext());
verify(qProfileStatusRepository).register(qp1.getQpKey(), UNCHANGED);
verify(qProfileStatusRepository).register(qp2.getQpKey(), ADDED);
verifyNoMoreInteractions(qProfileStatusRepository);
}
use of org.sonar.server.qualityprofile.QualityProfile in project sonarqube by SonarSource.
the class RegisterQualityProfileStatusStepTest method register_removed_profile.
@Test
public void register_removed_profile() {
QualityProfile qp = qp(QP_NAME_1, LANGUAGE_KEY_1, new Date());
mockBaseQPMeasures(treeRootHolder.getRoot(), new QualityProfile[] { qp });
underTest.execute(new TestComputationStepContext());
verify(qProfileStatusRepository).register(qp.getQpKey(), REMOVED);
verifyNoMoreInteractions(qProfileStatusRepository);
}
use of org.sonar.server.qualityprofile.QualityProfile in project sonarqube by SonarSource.
the class RegisterQualityProfileStatusStepTest method register_updated_profile.
@Test
public void register_updated_profile() {
QualityProfile qp1 = qp(QP_NAME_1, LANGUAGE_KEY_1, new Date(1000L));
QualityProfile qp2 = qp(QP_NAME_1, LANGUAGE_KEY_1, new Date(1200L));
mockBaseQPMeasures(treeRootHolder.getRoot(), arrayOf(qp1));
mockRawQProfiles(ImmutableList.of(qp2));
underTest.execute(new TestComputationStepContext());
verify(qProfileStatusRepository).register(qp2.getQpKey(), UPDATED);
verifyNoMoreInteractions(qProfileStatusRepository);
}
use of org.sonar.server.qualityprofile.QualityProfile in project sonarqube by SonarSource.
the class QualityProfileEventsStepTest method changed_event_if_qp_has_been_updated.
@Test
public void changed_event_if_qp_has_been_updated() {
QualityProfile qp1 = qp(QP_NAME_1, LANGUAGE_KEY_1, parseDateTime("2011-04-25T01:05:13+0100"));
QualityProfile qp2 = qp(QP_NAME_1, LANGUAGE_KEY_1, parseDateTime("2011-04-25T01:05:17+0100"));
qProfileStatusRepository.register(qp2.getQpKey(), UPDATED);
mockMeasures(treeRootHolder.getRoot(), arrayOf(qp1), arrayOf(qp2));
Language language = mockLanguageInRepository(LANGUAGE_KEY_1);
underTest.execute(new TestComputationStepContext());
verify(eventRepository).add(eq(treeRootHolder.getRoot()), eventArgumentCaptor.capture());
verifyNoMoreInteractions(eventRepository);
verifyEvent(eventArgumentCaptor.getValue(), "Changes in '" + qp2.getQpName() + "' (" + language.getName() + ")", "from=" + UtcDateUtils.formatDateTime(parseDateTime("2011-04-25T01:05:14+0100")) + ";key=" + qp1.getQpKey() + ";to=" + UtcDateUtils.formatDateTime(parseDateTime("2011-04-25T01:05:18+0100")));
}
Aggregations