Package org.sonar.process

Examples of org.sonar.process.Props


  @Test
  public void watch_stop_file() throws Exception {
    Monitor monitor = mock(Monitor.class);
    App app = new App(monitor);
    Props props = initDefaultProps();
    props.set("sonar.enableStopCommand", "true");
    app.start(props);

    assertThat(app.getStopWatcher()).isNotNull();
    assertThat(app.getStopWatcher().isAlive()).isTrue();
View Full Code Here


  @Test
  public void start_elasticsearch_and_tomcat_by_default() throws Exception {
    Monitor monitor = mock(Monitor.class);
    App app = new App(monitor);
    Props props = initDefaultProps();
    app.start(props);

    Class<List<JavaCommand>> listClass = (Class<List<JavaCommand>>)(Class)List.class;
    ArgumentCaptor<List<JavaCommand>> argument = ArgumentCaptor.forClass(listClass);
    verify(monitor).start(argument.capture());
View Full Code Here

  @Test
  public void do_not_start_tomcat_if_elasticsearch_slave() throws Exception {
    Monitor monitor = mock(Monitor.class);
    App app = new App(monitor);
    Props props = initDefaultProps();
    props.set("sonar.cluster.masterHost", "1.2.3.4");
    app.start(props);

    Class<List<JavaCommand>> listClass = (Class<List<JavaCommand>>)(Class)List.class;
    ArgumentCaptor<List<JavaCommand>> argument = ArgumentCaptor.forClass(listClass);
    verify(monitor).start(argument.capture());
View Full Code Here

  @Test
  public void add_custom_jdbc_driver_to_tomcat_classpath() throws Exception {
    Monitor monitor = mock(Monitor.class);
    App app = new App(monitor);
    Props props = initDefaultProps();
    props.set("sonar.jdbc.driverPath", "oracle/ojdbc6.jar");
    app.start(props);

    Class<List<JavaCommand>> listClass = (Class<List<JavaCommand>>)(Class)List.class;
    ArgumentCaptor<List<JavaCommand>> argument = ArgumentCaptor.forClass(listClass);
    verify(monitor).start(argument.capture());
View Full Code Here

    assertThat(argument.getValue().get(1).getClasspath()).contains("oracle/ojdbc6.jar");
  }

  private Props initDefaultProps() throws IOException {
    Props props = new Props(new Properties());
    DefaultSettings.init(props);
    props.set(ProcessConstants.PATH_HOME, temp.newFolder().getAbsolutePath());
    props.set(ProcessConstants.PATH_TEMP, temp.newFolder().getAbsolutePath());
    props.set(ProcessConstants.PATH_LOGS, temp.newFolder().getAbsolutePath());
    return props;
  }
View Full Code Here

    p = ConfigurationUtils.interpolateVariables(p, System.getenv());

    // the difference between Properties and Props is that the latter
    // supports decryption of values, so it must be used when values
    // are accessed
    Props props = new Props(p);
    DefaultSettings.init(props);

    // init file system
    initExistingDir(props, ProcessConstants.PATH_DATA, "data");
    initExistingDir(props, ProcessConstants.PATH_WEB, "web");
View Full Code Here

  public static void main(String[] args) throws Exception {
    new MinimumViableSystem().check();
    CommandLineParser cli = new CommandLineParser();
    Properties rawProperties = cli.parseArguments(args);
    Props props = new PropsBuilder(rawProperties, new JdbcSettings()).build();
    ProcessLogging logging = new ProcessLogging();
    logging.configure(props, "/org/sonar/application/logback.xml");
    if (props.valueAsBoolean("sonar.log.console", false)) {
      logging.addConsoleAppender();
    }

    App app = new App();
    app.start(props);
View Full Code Here

    }
  }

  @Test
  public void start_stop_server() throws Exception {
    Props props = new Props(new Properties());
    props.set(ProcessConstants.SEARCH_PORT, String.valueOf(port));
    props.set(ProcessConstants.CLUSTER_NAME, CLUSTER_NAME);
    props.set(ProcessConstants.CLUSTER_NODE_NAME, "test");
    props.set(ProcessConstants.PATH_HOME, temp.newFolder().getAbsolutePath());

    searchServer = new SearchServer(props);
    searchServer.start();
    assertThat(searchServer.isReady()).isTrue();
View Full Code Here

    }
  }

  @Test
  public void slave_success_replication() throws Exception {
    Props props = new Props(new Properties());
    props.set(ProcessConstants.SEARCH_PORT, String.valueOf(port));
    props.set(ProcessConstants.CLUSTER_ACTIVATE, "true");
    props.set(ProcessConstants.CLUSTER_MASTER, "true");
    props.set(ProcessConstants.CLUSTER_NODE_NAME, "MASTER");
    props.set(ProcessConstants.CLUSTER_NAME, CLUSTER_NAME);
    props.set(ProcessConstants.PATH_HOME, temp.newFolder().getAbsolutePath());
    searchServer = new SearchServer(props);
    assertThat(searchServer).isNotNull();

    searchServer.start();
    assertThat(searchServer.isReady()).isTrue();

    client = getSearchClient();
    client.admin().indices().prepareCreate("test").get();

    // start a slave
    props = new Props(new Properties());
    props.set(ProcessConstants.CLUSTER_ACTIVATE, "true");
    props.set(ProcessConstants.CLUSTER_MASTER_HOST, "localhost:" + port);
    props.set(ProcessConstants.CLUSTER_NAME, CLUSTER_NAME);
    props.set(ProcessConstants.CLUSTER_NODE_NAME, "SLAVE");
    props.set(ProcessConstants.SEARCH_PORT, String.valueOf(NetworkUtils.freePort()));
    props.set(ProcessConstants.PATH_HOME, temp.newFolder().getAbsolutePath());
    SearchServer slaveServer = new SearchServer(props);
    assertThat(slaveServer).isNotNull();

    slaveServer.start();
    assertThat(slaveServer.isReady()).isTrue();
View Full Code Here

    slaveServer.awaitStop();
  }

  @Test
  public void slave_failed_replication() throws Exception {
    Props props = new Props(new Properties());
    props.set(ProcessConstants.SEARCH_PORT, String.valueOf(port));
    props.set(ProcessConstants.CLUSTER_ACTIVATE, "false");
    props.set(ProcessConstants.CLUSTER_NAME, CLUSTER_NAME);
    props.set(ProcessConstants.CLUSTER_NODE_NAME, "NOT_MASTER");
    props.set(ProcessConstants.PATH_HOME, temp.newFolder().getAbsolutePath());
    searchServer = new SearchServer(props);
    assertThat(searchServer).isNotNull();

    searchServer.start();
    assertThat(searchServer.isReady()).isTrue();

    client = getSearchClient();
    client.admin().indices().prepareCreate("test").get();

    // start a slave
    props = new Props(new Properties());
    props.set(ProcessConstants.CLUSTER_ACTIVATE, "true");
    props.set(ProcessConstants.CLUSTER_MASTER, "false");
    props.set(ProcessConstants.CLUSTER_MASTER_HOST, "localhost:" + port);
    props.set(ProcessConstants.CLUSTER_NAME, CLUSTER_NAME);
    props.set(ProcessConstants.CLUSTER_NODE_NAME, "SLAVE");
    props.set(ProcessConstants.SEARCH_PORT, String.valueOf(NetworkUtils.freePort()));
    props.set(ProcessConstants.PATH_HOME, temp.newFolder().getAbsolutePath());
    SearchServer slaveServer = new SearchServer(props);
    assertThat(slaveServer).isNotNull();

    try {
      slaveServer.start();
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.