Java Code Examples for org.sonar.api.config.internal.MapSettings#asConfig()

The following examples show how to use org.sonar.api.config.internal.MapSettings#asConfig() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EsqlLanguageTest.java    From sonar-esql-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void defaultSuffixes() {
 MapSettings mapSettings = new MapSettings();
 mapSettings.setProperty(EsqlLanguage.FILE_SUFFIXES_KEY, EsqlLanguage.FILE_SUFFIXES_DEFVALUE);
 EsqlLanguage esqlLanguage = new EsqlLanguage(mapSettings.asConfig());
 assertThat(esqlLanguage.getFileSuffixes()).containsOnly(".esql");

}
 
Example 2
Source File: EsqlLanguageTest.java    From sonar-esql-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void customSuffixes() {

 MapSettings mapSettings = new MapSettings();
 mapSettings.setProperty(EsqlLanguage.FILE_SUFFIXES_KEY, "esql");
 EsqlLanguage esqlLanguage = new EsqlLanguage(mapSettings.asConfig());
 assertThat(esqlLanguage.getFileSuffixes()).containsOnly("esql");

}
 
Example 3
Source File: EsqlExclusionsFileFilterTest.java    From sonar-esql-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void should_exclude_using_custom_path_regex() throws Exception {
    MapSettings settings = new MapSettings();
    settings.setProperty(
            EsqlPlugin.ESQL_EXCLUSIONS_KEY, EsqlPlugin.ESQL_EXCLUSIONS_DEFAULT_VALUE + "," + "**/libs/**");

    EsqlExclusionsFileFilter filter = new EsqlExclusionsFileFilter(settings.asConfig());

    assertThat(filter.accept(inputFile("some_app.esql"))).isTrue();
    assertThat(filter.accept(inputFile("libs/some_lib.esql"))).isFalse();
}
 
Example 4
Source File: EsqlExclusionsFileFilterTest.java    From sonar-esql-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void should_ignore_empty_path_regex() throws Exception {
    MapSettings settings = new MapSettings();
    settings.setProperty(EsqlPlugin.ESQL_EXCLUSIONS_KEY, "," + EsqlPlugin.ESQL_EXCLUSIONS_DEFAULT_VALUE + ",");

    EsqlExclusionsFileFilter filter = new EsqlExclusionsFileFilter(settings.asConfig());

    assertThat(filter.accept(inputFile("some_app.esql"))).isTrue();
}
 
Example 5
Source File: CrowdConfigurationTest.java    From sonar-crowd with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Test
public void usesFallbackForUnsetApplicationName() {
  MapSettings settings = new MapSettings();
  settings.setProperty(CrowdConfiguration.KEY_CROWD_URL, "http://localhost:8095");
  settings.setProperty(CrowdConfiguration.KEY_CROWD_APP_PASSWORD, "secret");
  CrowdConfiguration crowdConfiguration = new CrowdConfiguration(settings.asConfig());
  assertThat(crowdConfiguration.getCrowdApplicationName(), is(CrowdConfiguration.FALLBACK_NAME));
}
 
Example 6
Source File: CrowdConfigurationTest.java    From sonar-crowd with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Test
public void createsClientProperties() {
  MapSettings settings = new MapSettings();
  settings.setProperty(CrowdConfiguration.KEY_CROWD_URL, "http://localhost:8095");
  settings.setProperty(CrowdConfiguration.KEY_CROWD_APP_NAME, "SonarQube");
  settings.setProperty(CrowdConfiguration.KEY_CROWD_APP_PASSWORD, "secret");
  CrowdConfiguration crowdConfiguration = new CrowdConfiguration(settings.asConfig());

  assertThat(crowdConfiguration.getCrowdUrl(), is("http://localhost:8095"));
  assertThat(crowdConfiguration.getCrowdApplicationName(), is("SonarQube"));
  assertThat(crowdConfiguration.getCrowdApplicationPassword(), is("secret"));
}
 
Example 7
Source File: ClojureTest.java    From sonar-clojure with MIT License 4 votes vote down vote up
@Before
public void setUp() {
    settings = new MapSettings();
    language = new Clojure(settings.asConfig());
}
 
Example 8
Source File: EsqlLanguageTest.java    From sonar-esql-plugin with Apache License 2.0 4 votes vote down vote up
@Before
public void setUp() {
  settings = new MapSettings();
  esqlLanguage = new EsqlLanguage(settings.asConfig());
}