Package org.sonar.process

Examples of org.sonar.process.Props


    Properties properties = new Properties();
    properties.setProperty(ProcessConstants.CLUSTER_NAME, clusterName);
    properties.setProperty(ProcessConstants.CLUSTER_NODE_NAME, "test");
    properties.setProperty(ProcessConstants.SEARCH_PORT, clusterPort.toString());
    properties.setProperty(ProcessConstants.PATH_HOME, homeDir.getAbsolutePath());
    searchServer = new SearchServer(new Props(properties));
  }
View Full Code Here


  public void check_oracle() throws Exception {
    File home = temp.newFolder();
    File driverFile = new File(home, "extensions/jdbc-driver/oracle/ojdbc6.jar");
    FileUtils.touch(driverFile);

    Props props = new Props(new Properties());
    props.set("sonar.jdbc.url", "jdbc:oracle:thin:@localhost/XE");
    settings.checkAndComplete(home, props);
    assertThat(props.nonNullValueAsFile(ProcessConstants.JDBC_DRIVER_PATH)).isEqualTo(driverFile);
  }
View Full Code Here

  }

  @Test
  public void check_h2() throws Exception {
    File home = temp.newFolder();
    Props props = new Props(new Properties());
    props.set("sonar.jdbc.url", "jdbc:h2:tcp://localhost:9092/sonar");
    settings.checkAndComplete(home, props);
    assertThat(props.value(ProcessConstants.JDBC_DRIVER_PATH)).isNull();
  }
View Full Code Here

  public void check_postgresql() throws Exception {
    File home = temp.newFolder();
    File driverFile = new File(home, "lib/jdbc/postgresql/pg.jar");
    FileUtils.touch(driverFile);

    Props props = new Props(new Properties());
    props.set("sonar.jdbc.url", "jdbc:postgresql://localhost/sonar");
    settings.checkAndComplete(home, props);
    assertThat(props.nonNullValueAsFile(ProcessConstants.JDBC_DRIVER_PATH)).isEqualTo(driverFile);
  }
View Full Code Here

  public void check_mssql() throws Exception {
    File home = temp.newFolder();
    File driverFile = new File(home, "lib/jdbc/jtds/jtds.jar");
    FileUtils.touch(driverFile);

    Props props = new Props(new Properties());
    props.set("sonar.jdbc.url", "jdbc:jtds:sqlserver://localhost/sonar;SelectMethod=Cursor");
    settings.checkAndComplete(home, props);
    assertThat(props.nonNullValueAsFile(ProcessConstants.JDBC_DRIVER_PATH)).isEqualTo(driverFile);
  }
View Full Code Here

public class DefaultSettingsTest {

  @Test
  public void init_defaults() throws Exception {
    Props props = new Props(new Properties());
    DefaultSettings.init(props);

    assertThat(props.value("sonar.search.javaOpts")).contains("-Xmx");
    assertThat(props.value("sonar.jdbc.username")).isEqualTo("sonar");
    assertThat(props.valueAsInt("sonar.jdbc.maxActive")).isEqualTo(50);
  }
View Full Code Here

  @Test
  public void do_not_override_existing_properties() throws Exception {
    Properties p = new Properties();
    p.setProperty("sonar.jdbc.username", "angela");
    Props props = new Props(p);
    DefaultSettings.init(props);

    assertThat(props.value("sonar.jdbc.username")).isEqualTo("angela");
  }
View Full Code Here

  @Test
  public void use_random_port_if_zero() throws Exception {
    Properties p = new Properties();
    p.setProperty("sonar.search.port", "0");
    Props props = new Props(p);

    DefaultSettings.init(props);
    assertThat(props.valueAsInt("sonar.search.port")).isGreaterThan(0);
  }
View Full Code Here

    FileUtils.forceMkdir(webDir);
    FileUtils.forceMkdir(logsDir);
    Properties rawProperties = new Properties();
    rawProperties.setProperty("foo", "bar");

    Props props = new PropsBuilder(rawProperties, jdbcSettings, homeDir).build();

    assertThat(props.nonNullValueAsFile("sonar.path.logs")).isEqualTo(logsDir);
    assertThat(props.nonNullValueAsFile("sonar.path.home")).isEqualTo(homeDir);

    // create <HOME>/temp
    File tempDir = props.nonNullValueAsFile("sonar.path.temp");
    assertThat(tempDir).isDirectory().exists();
    assertThat(tempDir.getName()).isEqualTo("temp");
    assertThat(tempDir.getParentFile()).isEqualTo(homeDir);

    assertThat(props.value("foo")).isEqualTo("bar");
    assertThat(props.value("unknown")).isNull();

    // default properties
    assertThat(props.valueAsInt("sonar.search.port")).isEqualTo(9001);
  }
View Full Code Here

    FileUtils.forceMkdir(webDir);
    FileUtils.forceMkdir(logsDir);

    Properties rawProperties = new Properties();
    rawProperties.setProperty("sonar.origin", "raw");
    Props props = new PropsBuilder(rawProperties, jdbcSettings, homeDir).build();

    assertThat(props.value("sonar.jdbc.username")).isEqualTo("angela");
    // command-line arguments override sonar.properties file
    assertThat(props.value("sonar.origin")).isEqualTo("raw");
  }
View Full Code Here

TOP

Related Classes of org.sonar.process.Props

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.