Search in sources :

Example 46 with MapSettings

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

the class NewIndexTest method five_shards_and_one_replica_by_default_on_cluster.

@Test
public void five_shards_and_one_replica_by_default_on_cluster() {
    NewIndex index = new NewIndex("issues");
    MapSettings settings = new MapSettings();
    settings.setProperty(ProcessProperties.CLUSTER_ENABLED, "true");
    index.configureShards(settings, 5);
    assertThat(index.getSettings().get(IndexMetaData.SETTING_NUMBER_OF_SHARDS)).isEqualTo("5");
    assertThat(index.getSettings().get(IndexMetaData.SETTING_NUMBER_OF_REPLICAS)).isEqualTo("1");
}
Also used : MapSettings(org.sonar.api.config.MapSettings) Test(org.junit.Test)

Example 47 with MapSettings

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

the class IssueIndexDefinitionTest method define.

@Test
public void define() {
    IssueIndexDefinition def = new IssueIndexDefinition(new MapSettings());
    def.define(underTest);
    assertThat(underTest.getIndices()).hasSize(1);
    NewIndex issuesIndex = underTest.getIndices().get("issues");
    assertThat(issuesIndex).isNotNull();
    assertThat(issuesIndex.getTypes().keySet()).containsOnly("issue", "authorization");
    // no cluster by default
    assertThat(issuesIndex.getSettings().get("index.number_of_shards")).isEqualTo("5");
    assertThat(issuesIndex.getSettings().get("index.number_of_replicas")).isEqualTo("0");
}
Also used : MapSettings(org.sonar.api.config.MapSettings) NewIndex(org.sonar.server.es.NewIndex) Test(org.junit.Test)

Example 48 with MapSettings

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

the class EmbeddedDatabaseTest method start_creates_db_with_specified_user_and_password.

@Test
public void start_creates_db_with_specified_user_and_password() throws IOException {
    int port = NetworkUtils.freePort();
    underTest = new EmbeddedDatabase(new MapSettings().setProperty(PATH_DATA, temporaryFolder.newFolder().getAbsolutePath()).setProperty(PROP_URL, "jdbc url").setProperty(PROP_EMBEDDED_PORT, "" + port).setProperty(PROP_USER, "foo").setProperty(PROP_PASSWORD, "bar"));
    underTest.start();
    checkDbIsUp(port, "foo", "bar");
}
Also used : MapSettings(org.sonar.api.config.MapSettings) Test(org.junit.Test)

Example 49 with MapSettings

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

the class FakeAuthenticatorTest method setUp.

@Before
public void setUp() {
    settings = new MapSettings();
    authenticator = new FakeAuthenticator(settings);
    authenticator.init();
}
Also used : MapSettings(org.sonar.api.config.MapSettings) Before(org.junit.Before)

Example 50 with MapSettings

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

the class XooTokenizerTest method prepare.

@Before
public void prepare() throws IOException {
    baseDir = temp.newFolder();
    fileSystem = new DefaultFileSystem(baseDir.toPath());
    when(context.fileSystem()).thenReturn(fileSystem);
    settings = new MapSettings();
    when(context.settings()).thenReturn(settings);
}
Also used : MapSettings(org.sonar.api.config.MapSettings) DefaultFileSystem(org.sonar.api.batch.fs.internal.DefaultFileSystem) Before(org.junit.Before)

Aggregations

MapSettings (org.sonar.api.config.MapSettings)98 Test (org.junit.Test)75 Settings (org.sonar.api.config.Settings)36 Before (org.junit.Before)20 URI (java.net.URI)13 Languages (org.sonar.api.resources.Languages)9 DefaultLanguagesRepository (org.sonar.scanner.repository.language.DefaultLanguagesRepository)9 LanguagesRepository (org.sonar.scanner.repository.language.LanguagesRepository)8 File (java.io.File)7 SensorStorage (org.sonar.api.batch.sensor.internal.SensorStorage)7 FileExclusions (org.sonar.api.scan.filesystem.FileExclusions)6 Properties (java.util.Properties)5 IndexedFile (org.sonar.api.batch.fs.IndexedFile)5 DefaultFileSystem (org.sonar.api.batch.fs.internal.DefaultFileSystem)5 DefaultIndexedFile (org.sonar.api.batch.fs.internal.DefaultIndexedFile)5 PropertyDefinitions (org.sonar.api.config.PropertyDefinitions)5 InputFile (org.sonar.api.batch.fs.InputFile)4 InputStream (java.io.InputStream)3 Description (org.hamcrest.Description)3 CoreProperties (org.sonar.api.CoreProperties)3