Search in sources :

Example 6 with Props

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

the class JdbcSettingsTest method checkAndComplete_sets_driver_path_for_postgresql.

@Test
public void checkAndComplete_sets_driver_path_for_postgresql() throws Exception {
    File driverFile = new File(homeDir, "lib/jdbc/postgresql/pg.jar");
    FileUtils.touch(driverFile);
    Props props = newProps(JDBC_URL, "jdbc:postgresql://localhost/sonar");
    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)

Example 7 with Props

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

the class JdbcSettingsTest method fail_with_MessageException_when_url_does_not_have_jdbc_prefix.

@Test
public void fail_with_MessageException_when_url_does_not_have_jdbc_prefix() {
    Props props = newProps(JDBC_URL, "oracle:thin:@localhost/XE");
    expectedException.expect(MessageException.class);
    expectedException.expectMessage("Bad format of JDBC URL: oracle:thin:@localhost/XE");
    underTest.resolveProviderAndEnforceNonnullJdbcUrl(props);
}
Also used : Props(org.sonar.process.Props) Test(org.junit.Test)

Example 8 with Props

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

the class JdbcSettingsTest method sets_driver_path_for_h2.

@Test
public void sets_driver_path_for_h2() throws Exception {
    File driverFile = new File(homeDir, "lib/jdbc/h2/h2.jar");
    FileUtils.touch(driverFile);
    Props props = newProps(JDBC_URL, "jdbc:h2:tcp://localhost:9092/sonar");
    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)

Example 9 with Props

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

the class EsSettingsTest method cluster_is_enabled.

@Test
public void cluster_is_enabled() throws Exception {
    Props props = minProps();
    props.set(ProcessProperties.CLUSTER_ENABLED, "true");
    props.set(ProcessProperties.CLUSTER_SEARCH_HOSTS, "1.2.3.4:9000,1.2.3.5:8080");
    Settings settings = new EsSettings(props).build();
    assertThat(settings.get("index.number_of_replicas")).isEqualTo("1");
    assertThat(settings.get("discovery.zen.ping.unicast.hosts")).isEqualTo("1.2.3.4:9000,1.2.3.5:8080");
}
Also used : Props(org.sonar.process.Props) Settings(org.elasticsearch.common.settings.Settings) Test(org.junit.Test)

Example 10 with Props

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

the class EsSettingsTest method enable_http_connector.

@Test
public void enable_http_connector() throws Exception {
    Props props = minProps();
    props.set(ProcessProperties.SEARCH_HTTP_PORT, "9010");
    Settings settings = new EsSettings(props).build();
    assertThat(settings.get("http.port")).isEqualTo("9010");
    assertThat(settings.get("http.host")).isEqualTo("127.0.0.1");
    assertThat(settings.get("http.enabled")).isEqualTo("true");
}
Also used : Props(org.sonar.process.Props) Settings(org.elasticsearch.common.settings.Settings) 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