Search in sources :

Example 96 with Props

use of org.sonar.process.Props in project sonarqube by SonarSource.

the class EsInstallationTest method conf_directory_is_conf_es_subdirectory_of_sq_temp_directory.

@Test
public void conf_directory_is_conf_es_subdirectory_of_sq_temp_directory() throws IOException {
    File tempDir = temp.newFolder();
    Props props = new Props(new Properties());
    props.set(PATH_DATA.getKey(), temp.newFolder().getAbsolutePath());
    props.set(PATH_HOME.getKey(), temp.newFolder().getAbsolutePath());
    props.set(PATH_TEMP.getKey(), tempDir.getAbsolutePath());
    props.set(PATH_LOGS.getKey(), temp.newFolder().getAbsolutePath());
    EsInstallation underTest = new EsInstallation(props);
    assertThat(underTest.getConfDirectory()).isEqualTo(new File(tempDir, "conf/es"));
}
Also used : Props(org.sonar.process.Props) Properties(java.util.Properties) File(java.io.File) Test(org.junit.Test)

Example 97 with Props

use of org.sonar.process.Props in project sonarqube by SonarSource.

the class EsInstallationTest method getLog4j2Properties_is_in_es_conf_directory.

@Test
public void getLog4j2Properties_is_in_es_conf_directory() throws IOException {
    File tempDir = temp.newFolder();
    Props props = new Props(new Properties());
    props.set(PATH_DATA.getKey(), temp.newFolder().getAbsolutePath());
    props.set(PATH_HOME.getKey(), temp.newFolder().getAbsolutePath());
    props.set(PATH_TEMP.getKey(), tempDir.getAbsolutePath());
    props.set(PATH_LOGS.getKey(), temp.newFolder().getAbsolutePath());
    EsInstallation underTest = new EsInstallation(props);
    assertThat(underTest.getLog4j2PropertiesLocation()).isEqualTo(new File(tempDir, "conf/es/log4j2.properties"));
}
Also used : Props(org.sonar.process.Props) Properties(java.util.Properties) File(java.io.File) Test(org.junit.Test)

Example 98 with Props

use of org.sonar.process.Props in project sonarqube by SonarSource.

the class EsInstallationTest method getElasticsearchYml_is_in_es_conf_directory.

@Test
public void getElasticsearchYml_is_in_es_conf_directory() throws IOException {
    File tempDir = temp.newFolder();
    Props props = new Props(new Properties());
    props.set(PATH_DATA.getKey(), temp.newFolder().getAbsolutePath());
    props.set(PATH_HOME.getKey(), temp.newFolder().getAbsolutePath());
    props.set(PATH_TEMP.getKey(), tempDir.getAbsolutePath());
    props.set(PATH_LOGS.getKey(), temp.newFolder().getAbsolutePath());
    EsInstallation underTest = new EsInstallation(props);
    assertThat(underTest.getElasticsearchYml()).isEqualTo(new File(tempDir, "conf/es/elasticsearch.yml"));
}
Also used : Props(org.sonar.process.Props) Properties(java.util.Properties) File(java.io.File) Test(org.junit.Test)

Example 99 with Props

use of org.sonar.process.Props in project sonarqube by SonarSource.

the class EsInstallationTest method getLogDirectory_is_configured_with_non_nullable_PATH_LOG_variable.

@Test
public void getLogDirectory_is_configured_with_non_nullable_PATH_LOG_variable() throws IOException {
    File sqHomeDir = temp.newFolder();
    File logDir = temp.newFolder();
    Props props = new Props(new Properties());
    props.set(PATH_DATA.getKey(), temp.newFolder().getAbsolutePath());
    props.set(PATH_HOME.getKey(), sqHomeDir.getAbsolutePath());
    props.set(PATH_TEMP.getKey(), temp.newFolder().getAbsolutePath());
    props.set(PATH_LOGS.getKey(), logDir.getAbsolutePath());
    EsInstallation underTest = new EsInstallation(props);
    assertThat(underTest.getLogDirectory()).isEqualTo(logDir);
}
Also used : Props(org.sonar.process.Props) Properties(java.util.Properties) File(java.io.File) Test(org.junit.Test)

Example 100 with Props

use of org.sonar.process.Props in project sonarqube by SonarSource.

the class EsLoggingTest method newProps.

private static Props newProps(String... propertyKeysAndValues) {
    assertThat(propertyKeysAndValues.length % 2).describedAs("Number of parameters must be even").isZero();
    Properties properties = new Properties();
    for (int i = 0; i < propertyKeysAndValues.length; i++) {
        properties.put(propertyKeysAndValues[i++], propertyKeysAndValues[i]);
    }
    return new Props(properties);
}
Also used : Properties(java.util.Properties) Props(org.sonar.process.Props)

Aggregations

Props (org.sonar.process.Props)143 Test (org.junit.Test)119 Properties (java.util.Properties)71 File (java.io.File)44 MessageException (org.sonar.process.MessageException)21 ProcessProperties (org.sonar.process.ProcessProperties)19 UseDataProvider (com.tngtech.java.junit.dataprovider.UseDataProvider)13 Settings (org.elasticsearch.common.settings.Settings)7 NodeHealth (org.sonar.process.cluster.health.NodeHealth)6 InetAddress (java.net.InetAddress)5 LoggerContext (ch.qos.logback.classic.LoggerContext)4 Tomcat (org.apache.catalina.startup.Tomcat)4 ImmutableMap (com.google.common.collect.ImmutableMap)3 Map (java.util.Map)3 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)3 Assert.fail (org.junit.Assert.fail)3 ArgumentMatchers.argThat (org.mockito.ArgumentMatchers.argThat)3 Mockito (org.mockito.Mockito)3 Mockito.mock (org.mockito.Mockito.mock)3 Mockito.verify (org.mockito.Mockito.verify)3