Search in sources :

Example 16 with Language

use of org.sonar.api.resources.Language in project sonarqube by SonarSource.

the class QualityProfileEventsStepTest method added_event_if_one_new_qp.

@Test
public void added_event_if_one_new_qp() {
    QualityProfile qp = qp(QP_NAME_1, LANGUAGE_KEY_1);
    Language language = mockLanguageInRepository(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() + "' (" + language.getName() + ")", null);
}
Also used : AbstractLanguage(org.sonar.api.resources.AbstractLanguage) Language(org.sonar.api.resources.Language) QualityProfile(org.sonar.server.qualityprofile.QualityProfile) Test(org.junit.Test)

Example 17 with Language

use of org.sonar.api.resources.Language in project sonarqube by SonarSource.

the class QualityProfileEventsStepTest method changed_event_if_same_qp_but_no_same_date.

@Test
public void changed_event_if_same_qp_but_no_same_date() {
    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"));
    mockMeasures(treeRootHolder.getRoot(), arrayOf(qp1), arrayOf(qp2));
    Language language = mockLanguageInRepository(LANGUAGE_KEY_1);
    underTest.execute();
    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")));
}
Also used : AbstractLanguage(org.sonar.api.resources.AbstractLanguage) Language(org.sonar.api.resources.Language) QualityProfile(org.sonar.server.qualityprofile.QualityProfile) Test(org.junit.Test)

Aggregations

Language (org.sonar.api.resources.Language)17 Test (org.junit.Test)4 AbstractLanguage (org.sonar.api.resources.AbstractLanguage)4 QualityProfileDto (org.sonar.db.qualityprofile.QualityProfileDto)4 JsonWriter (org.sonar.api.utils.text.JsonWriter)3 QualityProfile (org.sonar.server.qualityprofile.QualityProfile)3 Locale (java.util.Locale)1 Pattern (java.util.regex.Pattern)1 Matchers.anyString (org.mockito.Matchers.anyString)1 Languages (org.sonar.api.resources.Languages)1 RulesDefinition (org.sonar.api.server.rule.RulesDefinition)1 RuleRepositoryDto (org.sonar.db.rule.RuleRepositoryDto)1 WsTester (org.sonar.server.ws.WsTester)1