Search in sources :

Example 26 with Props

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

the class TomcatConnectorsTest method configure_defaults.

@Test
public void configure_defaults() {
    Props props = new Props(new Properties());
    TomcatConnectors.configure(tomcat, props);
    verifyHttpConnector(DEFAULT_PORT, ImmutableMap.of("minSpareThreads", 5, "maxThreads", 50, "acceptCount", 25));
}
Also used : Props(org.sonar.process.Props) Properties(java.util.Properties) Test(org.junit.Test)

Example 27 with Props

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

the class TomcatContextsTest method context_path.

@Test
public void context_path() {
    props.setProperty("sonar.web.context", "/foo");
    assertThat(TomcatContexts.getContextPath(new Props(props))).isEqualTo("/foo");
}
Also used : Props(org.sonar.process.Props) Test(org.junit.Test)

Example 28 with Props

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

the class FileSystemSettingsTest method relative_paths_are_converted_to_absolute_paths.

@Test
public void relative_paths_are_converted_to_absolute_paths() throws Exception {
    Props props = new Props(new Properties());
    props.set(PATH_HOME, homeDir.getAbsolutePath());
    // relative paths
    props.set(PATH_DATA, "data");
    props.set(PATH_LOGS, "logs");
    props.set(PATH_TEMP, "temp");
    // already absolute paths
    props.set(PATH_WEB, new File(homeDir, "web").getAbsolutePath());
    underTest.accept(props);
    assertThat(props.nonNullValue(PATH_DATA)).isEqualTo(new File(homeDir, "data").getAbsolutePath());
    assertThat(props.nonNullValue(PATH_LOGS)).isEqualTo(new File(homeDir, "logs").getAbsolutePath());
    assertThat(props.nonNullValue(PATH_TEMP)).isEqualTo(new File(homeDir, "temp").getAbsolutePath());
    assertThat(props.nonNullValue(PATH_WEB)).isEqualTo(new File(homeDir, "web").getAbsolutePath());
}
Also used : Props(org.sonar.process.Props) Properties(java.util.Properties) File(java.io.File) Test(org.junit.Test)

Example 29 with Props

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

the class JdbcSettingsTest method fail_with_MessageException_when_provider_is_not_supported.

@Test
public void fail_with_MessageException_when_provider_is_not_supported() {
    Props props = newProps(JDBC_URL, "jdbc:microsoft:sqlserver://localhost");
    expectedException.expect(MessageException.class);
    expectedException.expectMessage("Unsupported JDBC driver provider: microsoft");
    underTest.resolveProviderAndEnforceNonnullJdbcUrl(props);
}
Also used : Props(org.sonar.process.Props) Test(org.junit.Test)

Example 30 with Props

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

the class JdbcSettingsTest method checkAndComplete_sets_driver_path_for_oracle.

@Test
public void checkAndComplete_sets_driver_path_for_oracle() throws Exception {
    File driverFile = new File(homeDir, "extensions/jdbc-driver/oracle/ojdbc6.jar");
    FileUtils.touch(driverFile);
    Props props = newProps(JDBC_URL, "jdbc:oracle:thin:@localhost/XE");
    underTest.accept(props);
    assertThat(props.nonNullValueAsFile(ProcessProperties.JDBC_DRIVER_PATH)).isEqualTo(driverFile);
}
Also used : Props(org.sonar.process.Props) File(java.io.File) Test(org.junit.Test)

Aggregations

Props (org.sonar.process.Props)39 Test (org.junit.Test)32 Properties (java.util.Properties)20 File (java.io.File)11 ProcessProperties (org.sonar.process.ProcessProperties)9 Settings (org.elasticsearch.common.settings.Settings)7 InetAddress (java.net.InetAddress)3 Connector (org.apache.catalina.connector.Connector)3 ArgumentMatcher (org.mockito.ArgumentMatcher)3 ProcessEntryPoint (org.sonar.process.ProcessEntryPoint)3 ConnectException (java.net.ConnectException)1 URL (java.net.URL)1 Date (java.util.Date)1 StandardContext (org.apache.catalina.core.StandardContext)1 Tomcat (org.apache.catalina.startup.Tomcat)1 NoNodeAvailableException (org.elasticsearch.client.transport.NoNodeAvailableException)1 InetSocketTransportAddress (org.elasticsearch.common.transport.InetSocketTransportAddress)1 Matchers.anyString (org.mockito.Matchers.anyString)1 MutablePicoContainer (org.picocontainer.MutablePicoContainer)1 CoreProperties (org.sonar.api.CoreProperties)1