Search in sources :

Example 61 with Props

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

the class EsInstallationTest method getExecutable_resolve_executable_for_platform.

@Test
public void getExecutable_resolve_executable_for_platform() throws IOException {
    File sqHomeDir = 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(), temp.newFolder().getAbsolutePath());
    EsInstallation underTest = new EsInstallation(props);
    assertThat(underTest.getExecutable()).isEqualTo(new File(sqHomeDir, "elasticsearch/bin/elasticsearch"));
}
Also used : Props(org.sonar.process.Props) Properties(java.util.Properties) File(java.io.File) Test(org.junit.Test)

Example 62 with Props

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

the class LogbackHelperTest method setLevelToOff.

private void setLevelToOff(Level globalLogLevel) {
    Properties properties = new Properties();
    properties.setProperty("sonar.log.level", globalLogLevel.toString());
    LoggerContext context = underTest.apply(newLogLevelConfig().offUnlessTrace("fii").build(), new Props(properties));
    assertThat(context.getLogger("fii").getLevel()).isEqualTo(Level.OFF);
}
Also used : Properties(java.util.Properties) Props(org.sonar.process.Props) LoggerContext(ch.qos.logback.classic.LoggerContext)

Example 63 with Props

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

the class LogbackHelperTest method log_to_console_setting_enabled.

@Test
public void log_to_console_setting_enabled() {
    Properties properties = new Properties();
    properties.setProperty("sonar.log.console", "true");
    assertThat(underTest.isAllLogsToConsoleEnabled(new Props(properties))).isTrue();
}
Also used : Properties(java.util.Properties) Props(org.sonar.process.Props) Test(org.junit.Test)

Example 64 with Props

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

the class Log4JPropertiesBuilderTest method newLog4JPropertiesBuilder.

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

Example 65 with Props

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

the class TomcatConnectorsTest method test_max_http_header_size_for_http_connection.

@Test
public void test_max_http_header_size_for_http_connection() {
    TomcatConnectors.configure(tomcat, new Props(new Properties()));
    verifyHttpConnector(DEFAULT_PORT, ImmutableMap.of("maxHttpHeaderSize", TomcatConnectors.MAX_HTTP_HEADER_SIZE_BYTES));
}
Also used : Props(org.sonar.process.Props) Properties(java.util.Properties) Test(org.junit.Test)

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