Search in sources :

Example 11 with Configuration

use of org.sonar.api.config.Configuration in project sonarqube by SonarSource.

the class ConfigurationProviderTest method getStringArray_split_on_comma_trim_and_support_encoded_comma_as_Settings_getStringArray.

@Test
@UseDataProvider("trimFieldsAndEncodedCommas")
public void getStringArray_split_on_comma_trim_and_support_encoded_comma_as_Settings_getStringArray(String idemUseCase) {
    settings.setProperty(nonDeclaredKey, idemUseCase);
    settings.setProperty(nonMultivalueKey, idemUseCase);
    settings.setProperty(multivalueKey, idemUseCase);
    Configuration configuration = underTest.provide(settings);
    getStringArrayBehaviorIsTheSame(configuration, nonDeclaredKey);
    getStringArrayBehaviorIsTheSame(configuration, nonMultivalueKey);
    getStringArrayBehaviorIsTheSame(configuration, multivalueKey);
}
Also used : Configuration(org.sonar.api.config.Configuration) Test(org.junit.Test) UseDataProvider(com.tngtech.java.junit.dataprovider.UseDataProvider)

Example 12 with Configuration

use of org.sonar.api.config.Configuration in project sonarqube by SonarSource.

the class ConfigurationProviderTest method getStringArray_parses_empty_string_differently_from_Settings_ifmultivalue_property.

@Test
@UseDataProvider("emptyStrings")
public void getStringArray_parses_empty_string_differently_from_Settings_ifmultivalue_property(String emptyValue) {
    settings.setProperty(multivalueKey, emptyValue);
    Configuration configuration = underTest.provide(settings);
    getStringArrayBehaviorDiffers(configuration, multivalueKey, EMPTY_STRING_ARRAY);
}
Also used : Configuration(org.sonar.api.config.Configuration) Test(org.junit.Test) UseDataProvider(com.tngtech.java.junit.dataprovider.UseDataProvider)

Example 13 with Configuration

use of org.sonar.api.config.Configuration in project sonarqube by SonarSource.

the class ConfigurationProviderTest method getStringArray_on_unknown_or_non_multivalue_properties_ignores_subsequent_commas_as_Settings.

@Test
@UseDataProvider("subsequentCommas1")
public void getStringArray_on_unknown_or_non_multivalue_properties_ignores_subsequent_commas_as_Settings(String subsequentCommas) {
    settings.setProperty(nonDeclaredKey, subsequentCommas);
    settings.setProperty(nonMultivalueKey, subsequentCommas);
    Configuration configuration = underTest.provide(settings);
    getStringArrayBehaviorIsTheSame(configuration, nonDeclaredKey);
    getStringArrayBehaviorIsTheSame(configuration, nonMultivalueKey);
}
Also used : Configuration(org.sonar.api.config.Configuration) Test(org.junit.Test) UseDataProvider(com.tngtech.java.junit.dataprovider.UseDataProvider)

Example 14 with Configuration

use of org.sonar.api.config.Configuration in project sonarqube by SonarSource.

the class ConfigurationProviderTest method getStringArray_on_unknown_or_non_multivalue_properties_ignores_empty_fields_differently_from_settings.

@Test
@UseDataProvider("emptyFields2")
public void getStringArray_on_unknown_or_non_multivalue_properties_ignores_empty_fields_differently_from_settings(String emptyFields, String[] expected) {
    settings.setProperty(nonDeclaredKey, emptyFields);
    settings.setProperty(nonMultivalueKey, emptyFields);
    Configuration configuration = underTest.provide(settings);
    getStringArrayBehaviorDiffers(configuration, nonDeclaredKey, expected);
    getStringArrayBehaviorDiffers(configuration, nonMultivalueKey, expected);
}
Also used : Configuration(org.sonar.api.config.Configuration) Test(org.junit.Test) UseDataProvider(com.tngtech.java.junit.dataprovider.UseDataProvider)

Example 15 with Configuration

use of org.sonar.api.config.Configuration in project sonarqube by SonarSource.

the class ConfigurationProviderTest method getStringArray_parses_empty_string_the_same_Settings_if_unknown_or_non_multivalue_property.

@Test
@UseDataProvider("emptyStrings")
public void getStringArray_parses_empty_string_the_same_Settings_if_unknown_or_non_multivalue_property(String emptyValue) {
    settings.setProperty(nonDeclaredKey, emptyValue);
    settings.setProperty(nonMultivalueKey, emptyValue);
    Configuration configuration = underTest.provide(settings);
    getStringArrayBehaviorIsTheSame(configuration, nonDeclaredKey);
    getStringArrayBehaviorIsTheSame(configuration, nonMultivalueKey);
}
Also used : Configuration(org.sonar.api.config.Configuration) Test(org.junit.Test) UseDataProvider(com.tngtech.java.junit.dataprovider.UseDataProvider)

Aggregations

Configuration (org.sonar.api.config.Configuration)47 Test (org.junit.Test)40 UseDataProvider (com.tngtech.java.junit.dataprovider.UseDataProvider)14 ComponentDto (org.sonar.db.component.ComponentDto)12 QGChangeEvent (org.sonar.server.qualitygate.changeevent.QGChangeEvent)7 MapSettings (org.sonar.api.config.internal.MapSettings)5 SnapshotDto (org.sonar.db.component.SnapshotDto)4 PropertyDefinitions (org.sonar.api.config.PropertyDefinitions)3 Encryption (org.sonar.api.config.internal.Encryption)3 Metric (org.sonar.api.measures.Metric)3 DefaultBranchImpl (org.sonar.ce.task.projectanalysis.component.DefaultBranchImpl)3 HashSet (java.util.HashSet)2 DbClient (org.sonar.db.DbClient)2 BranchDto (org.sonar.db.component.BranchDto)2 LiveMeasureDto (org.sonar.db.measure.LiveMeasureDto)2 MetricDto (org.sonar.db.metric.MetricDto)2 ProjectDto (org.sonar.db.project.ProjectDto)2 EvaluatedQualityGate (org.sonar.server.qualitygate.EvaluatedQualityGate)2 QualityGate (org.sonar.server.qualitygate.QualityGate)2 File (java.io.File)1