use of org.sonar.server.qualityprofile.QualityProfile in project sonarqube by SonarSource.
the class QualityProfileEventsStepTest method no_more_used_event_if_qp_is_removed.
@Test
public void no_more_used_event_if_qp_is_removed() {
QualityProfile qp = qp(QP_NAME_1, LANGUAGE_KEY_1, new Date());
qProfileStatusRepository.register(qp.getQpKey(), REMOVED);
mockMeasures(treeRootHolder.getRoot(), arrayOf(qp), null);
Language language = mockLanguageInRepository(LANGUAGE_KEY_1);
underTest.execute(new TestComputationStepContext());
verify(eventRepository).add(eq(treeRootHolder.getRoot()), eventArgumentCaptor.capture());
verifyNoMoreInteractions(eventRepository);
verifyEvent(eventArgumentCaptor.getValue(), "Stop using '" + qp.getQpName() + "' (" + language.getName() + ")", null);
}
use of org.sonar.server.qualityprofile.QualityProfile in project sonarqube by SonarSource.
the class QualityProfileEventsStepTest method no_event_if_qp_is_unchanged.
@Test
public void no_event_if_qp_is_unchanged() {
QualityProfile qp = qp(QP_NAME_1, LANGUAGE_KEY_1, new Date());
qProfileStatusRepository.register(qp.getQpKey(), UNCHANGED);
mockMeasures(treeRootHolder.getRoot(), arrayOf(qp), arrayOf(qp));
underTest.execute(new TestComputationStepContext());
verify(eventRepository, never()).add(any(Component.class), any(Event.class));
}
use of org.sonar.server.qualityprofile.QualityProfile in project sonarqube by SonarSource.
the class ComponentActionTest method return_quality_profiles_and_supports_deleted_ones.
@Test
public void return_quality_profiles_and_supports_deleted_ones() {
ComponentDto project = insertProject();
QProfileDto qp1 = db.qualityProfiles().insert(t -> t.setKee("qp1").setName("Sonar Way Java").setLanguage("java"));
QProfileDto qp2 = db.qualityProfiles().insert(t -> t.setKee("qp2").setName("Sonar Way Xoo").setLanguage("xoo"));
addQualityProfiles(project, new QualityProfile(qp1.getKee(), qp1.getName(), qp1.getLanguage(), new Date()), new QualityProfile(qp2.getKee(), qp2.getName(), qp2.getLanguage(), new Date()));
userSession.addProjectPermission(UserRole.USER, project);
init();
executeAndVerify(project.getDbKey(), "return_quality_profiles.json");
db.getDbClient().qualityProfileDao().deleteOrgQProfilesByUuids(db.getSession(), ImmutableSet.of(qp1.getKee(), qp2.getKee()));
db.commit();
executeAndVerify(project.getDbKey(), "return_deleted_quality_profiles.json");
}
use of org.sonar.server.qualityprofile.QualityProfile in project sonarqube by SonarSource.
the class ComputeQProfileMeasureStepTest method fail_if_report_inconsistant.
@Test
public void fail_if_report_inconsistant() throws Exception {
treeRootHolder.setRoot(MULTI_MODULE_PROJECT);
QualityProfile qpJava = createQProfile(QP_NAME_1, LANGUAGE_KEY_1);
analysisMetadataHolder.setQProfilesByLanguage(ImmutableMap.of(LANGUAGE_KEY_1, qpJava));
try {
underTest.execute();
fail("Expected exception");
} catch (Exception e) {
assertThat(e).hasCause(new IllegalStateException("Report contains a file with language 'php' but no matching quality profile"));
}
}
use of org.sonar.server.qualityprofile.QualityProfile in project sonarqube by SonarSource.
the class QualityProfileEventsStepTest method added_event_uses_language_key_in_message_if_language_not_found.
@Test
public void added_event_uses_language_key_in_message_if_language_not_found() {
QualityProfile qp = qp(QP_NAME_1, LANGUAGE_KEY_1);
mockLanguageNotInRepository(LANGUAGE_KEY_1);
mockMeasures(treeRootHolder.getRoot(), null, arrayOf(qp));
underTest.execute();
verify(eventRepository).add(eq(treeRootHolder.getRoot()), eventArgumentCaptor.capture());
verifyNoMoreInteractions(eventRepository);
verifyEvent(eventArgumentCaptor.getValue(), "Use '" + qp.getQpName() + "' (" + qp.getLanguageKey() + ")", null);
}
Aggregations