use of org.sonar.process.Props in project sonarqube by SonarSource.
the class TomcatContextsTest method context_path_must_start_with_slash.
@Test
public void context_path_must_start_with_slash() {
props.setProperty("sonar.web.context", "foo");
expectedException.expect(MessageException.class);
expectedException.expectMessage("Value of 'sonar.web.context' must start with a forward slash: 'foo'");
underTest.configure(tomcat, new Props(props));
}
use of org.sonar.process.Props in project sonarqube by SonarSource.
the class EsServerHolder method get.
public static synchronized EsServerHolder get() throws IOException {
if (HOLDER == null) {
File homeDir = Files.createTempDirectory("tmp-es-").toFile();
homeDir.delete();
homeDir.mkdir();
String clusterName = "testCluster";
String hostName = "127.0.0.1";
int port = NetworkUtils.freePort();
Properties properties = new Properties();
properties.setProperty(ProcessProperties.CLUSTER_NAME, clusterName);
properties.setProperty(ProcessProperties.SEARCH_PORT, String.valueOf(port));
properties.setProperty(ProcessProperties.SEARCH_HOST, hostName);
properties.setProperty(ProcessProperties.PATH_HOME, homeDir.getAbsolutePath());
properties.setProperty(ProcessEntryPoint.PROPERTY_SHARED_PATH, homeDir.getAbsolutePath());
SearchServer server = new SearchServer(new Props(properties));
server.start();
HOLDER = new EsServerHolder(server, clusterName, port, hostName, homeDir);
}
HOLDER.reset();
return HOLDER;
}
use of org.sonar.process.Props in project sonarqube by SonarSource.
the class TomcatAccessLogTest method enable_access_logs_by_Default.
@Test
public void enable_access_logs_by_Default() throws Exception {
Tomcat tomcat = mock(Tomcat.class, Mockito.RETURNS_DEEP_STUBS);
Props props = new Props(new Properties());
props.set(ProcessProperties.PATH_LOGS, temp.newFolder().getAbsolutePath());
underTest.configure(tomcat, props);
verify(tomcat.getHost().getPipeline()).addValve(any(ProgrammaticLogbackValve.class));
}
use of org.sonar.process.Props in project sonarqube by SonarSource.
the class TomcatConnectorsTest method configure_thread_pool.
@Test
public void configure_thread_pool() {
Properties p = new Properties();
p.setProperty("sonar.web.http.minThreads", "2");
p.setProperty("sonar.web.http.maxThreads", "30");
p.setProperty("sonar.web.http.acceptCount", "20");
Props props = new Props(p);
TomcatConnectors.configure(tomcat, props);
verifyHttpConnector(DEFAULT_PORT, ImmutableMap.of("minSpareThreads", 2, "maxThreads", 30, "acceptCount", 20));
}
use of org.sonar.process.Props in project sonarqube by SonarSource.
the class TomcatConnectorsTest method bind_to_all_addresses_by_default.
@Test
public void bind_to_all_addresses_by_default() {
Properties p = new Properties();
p.setProperty("sonar.web.port", "9000");
TomcatConnectors.configure(tomcat, new Props(p));
verify(tomcat.getService()).addConnector(argThat(new ArgumentMatcher<Connector>() {
@Override
public boolean matches(Object o) {
Connector c = (Connector) o;
return c.getScheme().equals("http") && c.getPort() == 9000 && ((InetAddress) c.getProperty("address")).getHostAddress().equals("0.0.0.0");
}
}));
}
Aggregations