Package org.sonar.process

Examples of org.sonar.process.Props


  public TemporaryFolder temp = new TemporaryFolder();

  @Test
  public void fail_if_tcp_port_is_not_set() throws Exception {
    try {
      new SearchSettings(new Props(new Properties()));
      fail();
    } catch (MessageException e) {
      assertThat(e).hasMessage("Property is not set: sonar.search.port");
    }
  }
View Full Code Here


  }

  @Test
  public void test_default_settings() throws Exception {
    File homeDir = temp.newFolder();
    Props props = new Props(new Properties());
    props.set(ProcessConstants.SEARCH_PORT, "1234");
    props.set(ProcessConstants.PATH_HOME, homeDir.getAbsolutePath());
    props.set(ProcessConstants.CLUSTER_NAME, "tests");
    props.set(ProcessConstants.CLUSTER_NODE_NAME, "test");

    SearchSettings searchSettings = new SearchSettings(props);
    assertThat(searchSettings.inCluster()).isFalse();
    assertThat(searchSettings.clusterName()).isEqualTo("tests");
    assertThat(searchSettings.tcpPort()).isEqualTo(1234);
View Full Code Here

  }

  @Test
  public void override_dirs() throws Exception {
    File dataDir = temp.newFolder(), logDir = temp.newFolder(), tempDir = temp.newFolder();
    Props props = minProps();
    props.set(ProcessConstants.PATH_DATA, dataDir.getAbsolutePath());
    props.set(ProcessConstants.PATH_LOGS, logDir.getAbsolutePath());
    props.set(ProcessConstants.PATH_TEMP, tempDir.getAbsolutePath());

    Settings settings = new SearchSettings(props).build();

    assertThat(settings.get("path.data")).isEqualTo(new File(dataDir, "es").getAbsolutePath());
    assertThat(settings.get("path.logs")).isEqualTo(logDir.getAbsolutePath());
View Full Code Here

    assertThat(settings.get("path.work")).isEqualTo(tempDir.getAbsolutePath());
  }

  @Test
  public void test_cluster_master() throws Exception {
    Props props = minProps();
    props.set(ProcessConstants.CLUSTER_ACTIVATE, "true");
    props.set(ProcessConstants.CLUSTER_MASTER, "true");
    Settings settings = new SearchSettings(props).build();

    assertThat(settings.get("index.number_of_replicas")).isEqualTo("1");
    assertThat(settings.get("discovery.zen.ping.unicast.hosts")).isNull();
    assertThat(settings.get("node.master")).isEqualTo("true");
View Full Code Here

    assertThat(settings.get("node.master")).isEqualTo("true");
  }

  @Test
  public void test_cluster_slave() throws Exception {
    Props props = minProps();
    props.set(ProcessConstants.CLUSTER_ACTIVATE, "true");
    props.set(ProcessConstants.CLUSTER_MASTER_HOST, "127.0.0.2,127.0.0.3");
    Settings settings = new SearchSettings(props).build();

    assertThat(settings.get("discovery.zen.ping.unicast.hosts")).isEqualTo("127.0.0.2,127.0.0.3");
    assertThat(settings.get("node.master")).isEqualTo("false");
  }
View Full Code Here

    assertThat(settings.get("node.master")).isEqualTo("false");
  }

  @Test
  public void bad_cluster_configuration() throws Exception {
    Props props = minProps();
    props.set(ProcessConstants.CLUSTER_ACTIVATE, "true");
    try {
      new SearchSettings(props).build();
      fail();
    } catch (MessageException e) {
    }
View Full Code Here

    }
  }

  @Test
  public void enable_marvel() throws Exception {
    Props props = minProps();
    props.set(SearchSettings.PROP_MARVEL_HOSTS, "127.0.0.2,127.0.0.3");
    Settings settings = new SearchSettings(props).build();

    assertThat(settings.get("marvel.agent.exporter.es.hosts")).isEqualTo("127.0.0.2,127.0.0.3");
  }
View Full Code Here

    assertThat(settings.get("marvel.agent.exporter.es.hosts")).isEqualTo("127.0.0.2,127.0.0.3");
  }

  @Test
  public void enable_http_connector() throws Exception {
    Props props = minProps();
    props.set(SearchSettings.PROP_HTTP_PORT, "9010");
    Settings settings = new SearchSettings(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");
View Full Code Here

    assertThat(settings.get("http.enabled")).isEqualTo("true");
  }

  private Props minProps() throws IOException {
    File homeDir = temp.newFolder();
    Props props = new Props(new Properties());
    props.set(ProcessConstants.SEARCH_PORT, "1234");
    props.set(ProcessConstants.PATH_HOME, homeDir.getAbsolutePath());
    props.set(ProcessConstants.CLUSTER_NAME, "tests");
    props.set(ProcessConstants.CLUSTER_NODE_NAME, "test");
    return props;
  }
View Full Code Here

  public void context_path_must_start_with_slash() throws Exception {
    Properties p = new Properties();
    p.setProperty("sonar.web.context", "foo");

    try {
      Webapp.getContextPath(new Props(p));
      fail();
    } catch (IllegalStateException e) {
      assertThat(e.getMessage()).isEqualTo("Value of 'sonar.web.context' must start with a forward slash: 'foo'");
    }
  }
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.