Search in sources :

Example 16 with MapSettings

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

the class ViewIndexDefinitionTest method define.

@Test
public void define() {
    ViewIndexDefinition def = new ViewIndexDefinition(new MapSettings());
    def.define(underTest);
    assertThat(underTest.getIndices()).hasSize(1);
    NewIndex index = underTest.getIndices().get("views");
    assertThat(index).isNotNull();
    assertThat(index.getTypes().keySet()).containsOnly("view");
    assertThat(index.getSettings().get("index.number_of_shards")).isEqualTo("5");
    assertThat(index.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 17 with MapSettings

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

the class DefaultHttpDownloaderTest method readGzipString.

@Test
public void readGzipString() throws URISyntaxException {
    String text = new DefaultHttpDownloader(new MapSettings()).readString(new URI(baseUrl + "/gzip/"), StandardCharsets.UTF_8);
    assertThat(text).isEqualTo("GZIP response");
}
Also used : MapSettings(org.sonar.api.config.MapSettings) URI(java.net.URI) Test(org.junit.Test)

Example 18 with MapSettings

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

the class DefaultHttpDownloaderTest method uri_description.

@Test
public void uri_description() throws URISyntaxException {
    String description = new DefaultHttpDownloader(new MapSettings()).description(new URI("http://sonarsource.org"));
    assertThat(description).matches("http://sonarsource.org \\(.*\\)");
}
Also used : MapSettings(org.sonar.api.config.MapSettings) URI(java.net.URI) Test(org.junit.Test)

Example 19 with MapSettings

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

the class DefaultHttpDownloaderTest method readString.

@Test
public void readString() throws URISyntaxException {
    String text = new DefaultHttpDownloader(new MapSettings()).readString(new URI(baseUrl), StandardCharsets.UTF_8);
    assertThat(text.length()).isGreaterThan(10);
}
Also used : MapSettings(org.sonar.api.config.MapSettings) URI(java.net.URI) Test(org.junit.Test)

Example 20 with MapSettings

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

the class DefaultHttpDownloaderTest method downloadToFile.

@Test
public void downloadToFile() throws URISyntaxException, IOException {
    File toDir = temporaryFolder.newFolder();
    File toFile = new File(toDir, "downloadToFile.txt");
    new DefaultHttpDownloader(new MapSettings()).download(new URI(baseUrl), toFile);
    assertThat(toFile).exists();
    assertThat(toFile.length()).isGreaterThan(10l);
}
Also used : MapSettings(org.sonar.api.config.MapSettings) File(java.io.File) URI(java.net.URI) Test(org.junit.Test)

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