use of org.sonar.process.Props in project sonarqube by SonarSource.
the class EsSettingsTest method override_dirs.
@Test
public void override_dirs() throws Exception {
File dataDir = temp.newFolder();
File logDir = temp.newFolder();
File tempDir = temp.newFolder();
Props props = minProps();
props.set(ProcessProperties.PATH_DATA, dataDir.getAbsolutePath());
props.set(ProcessProperties.PATH_LOGS, logDir.getAbsolutePath());
props.set(ProcessProperties.PATH_TEMP, tempDir.getAbsolutePath());
Settings settings = new EsSettings(props).build();
assertThat(settings.get("path.data")).isEqualTo(new File(dataDir, "es").getAbsolutePath());
assertThat(settings.get("path.logs")).isEqualTo(logDir.getAbsolutePath());
assertThat(settings.get("path.home")).isEqualTo(new File(tempDir, "es").getAbsolutePath());
}
use of org.sonar.process.Props in project sonarqube by SonarSource.
the class EsSettingsTest method enable_marvel.
@Test
public void enable_marvel() throws Exception {
Props props = minProps();
props.set(EsSettings.PROP_MARVEL_HOSTS, "127.0.0.2,127.0.0.3");
Settings settings = new EsSettings(props).build();
assertThat(settings.get("marvel.agent.exporter.es.hosts")).isEqualTo("127.0.0.2,127.0.0.3");
}
use of org.sonar.process.Props in project sonarqube by SonarSource.
the class EsSettingsTest method enable_http_connector_different_host.
@Test
public void enable_http_connector_different_host() throws Exception {
Props props = minProps();
props.set(ProcessProperties.SEARCH_HTTP_PORT, "9010");
props.set(ProcessProperties.SEARCH_HOST, "127.0.0.2");
Settings settings = new EsSettings(props).build();
assertThat(settings.get("http.port")).isEqualTo("9010");
assertThat(settings.get("http.host")).isEqualTo("127.0.0.2");
assertThat(settings.get("http.enabled")).isEqualTo("true");
}
use of org.sonar.process.Props in project sonarqube by SonarSource.
the class SearchServerTest method start_stop_server.
@Test
public void start_stop_server() throws Exception {
Props props = new Props(new Properties());
// the following properties have always default values (see ProcessProperties)
InetAddress host = InetAddress.getLoopbackAddress();
props.set(ProcessProperties.SEARCH_HOST, host.getHostAddress());
props.set(ProcessProperties.SEARCH_PORT, String.valueOf(port));
props.set(ProcessProperties.CLUSTER_NAME, A_CLUSTER_NAME);
props.set(EsSettings.CLUSTER_SEARCH_NODE_NAME, A_NODE_NAME);
props.set(ProcessProperties.PATH_HOME, temp.newFolder().getAbsolutePath());
props.set(ProcessEntryPoint.PROPERTY_SHARED_PATH, temp.newFolder().getAbsolutePath());
underTest = new SearchServer(props);
underTest.start();
assertThat(underTest.getStatus()).isEqualTo(Monitored.Status.OPERATIONAL);
Settings settings = Settings.builder().put("cluster.name", A_CLUSTER_NAME).build();
client = TransportClient.builder().settings(settings).build().addTransportAddress(new InetSocketTransportAddress(host, port));
assertThat(client.admin().cluster().prepareClusterStats().get().getStatus()).isEqualTo(ClusterHealthStatus.GREEN);
underTest.stop();
underTest.awaitStop();
underTest = null;
try {
client.admin().cluster().prepareClusterStats().get();
fail();
} catch (NoNodeAvailableException exception) {
// ok
}
}
use of org.sonar.process.Props in project sonarqube by SonarSource.
the class WebServerProcessLoggingTest method check_level_of_jul.
@Test
public void check_level_of_jul() throws IOException {
Props props = new Props(new Properties());
File dir = temp.newFolder();
props.set(PATH_LOGS.getKey(), dir.getAbsolutePath());
props.set("sonar.log.level.web", "TRACE");
LoggerContext ctx = underTest.configure(props);
MemoryAppender memoryAppender = new MemoryAppender();
memoryAppender.start();
ctx.getLogger(ROOT_LOGGER_NAME).addAppender(memoryAppender);
java.util.logging.Logger logger = java.util.logging.Logger.getLogger("com.ms.sqlserver.jdbc.DTV");
logger.finest("Test");
memoryAppender.stop();
assertThat(memoryAppender.getLogs()).hasSize(1);
}
Aggregations