use of org.sonar.process.Props in project sonarqube by SonarSource.
the class TomcatContextsTest method default_context_path_is_root.
@Test
public void default_context_path_is_root() {
String context = TomcatContexts.getContextPath(new Props(new Properties()));
assertThat(context).isEmpty();
}
use of org.sonar.process.Props in project sonarqube by SonarSource.
the class TomcatContextsTest method root_context_path_must_be_blank.
@Test
public void root_context_path_must_be_blank() {
props.setProperty("sonar.web.context", "/");
assertThat(TomcatContexts.getContextPath(new Props(props))).isEmpty();
}
use of org.sonar.process.Props in project sonarqube by SonarSource.
the class TomcatContextsTest method configure_root_webapp.
@Test
public void configure_root_webapp() {
props.setProperty("foo", "bar");
StandardContext context = mock(StandardContext.class);
when(tomcat.addWebapp(anyString(), anyString())).thenReturn(context);
underTest.configure(tomcat, new Props(props));
// configure webapp with properties
verify(context).addParameter("foo", "bar");
}
use of org.sonar.process.Props in project sonarqube by SonarSource.
the class WebSecurityManagerTest method apply_calls_PluginSecurityManager.
@Test
public void apply_calls_PluginSecurityManager() {
Properties properties = new Properties();
properties.setProperty(PATH_HOME.getKey(), "home");
properties.setProperty(PATH_TEMP.getKey(), "temp");
Props props = new Props(properties);
WebSecurityManager securityManager = new WebSecurityManager(pluginSecurityManager, props);
securityManager.apply();
verify(pluginSecurityManager).restrictPlugins(any(PluginFileWriteRule.class));
}
use of org.sonar.process.Props in project sonarqube by SonarSource.
the class EsSettingsTest method test_default_settings.
@Test
public void test_default_settings() throws Exception {
File homeDir = temp.newFolder();
Props props = new Props(new Properties());
props.set(ProcessProperties.SEARCH_PORT, "1234");
props.set(ProcessProperties.SEARCH_HOST, "127.0.0.1");
props.set(ProcessProperties.PATH_HOME, homeDir.getAbsolutePath());
props.set(ProcessProperties.CLUSTER_NAME, "sonarqube");
EsSettings esSettings = new EsSettings(props);
Settings generated = esSettings.build();
assertThat(generated.get("transport.tcp.port")).isEqualTo("1234");
assertThat(generated.get("transport.host")).isEqualTo("127.0.0.1");
// no cluster, but cluster and node names are set though
assertThat(generated.get("cluster.name")).isEqualTo("sonarqube");
assertThat(generated.get("node.name")).isEqualTo("sonarqube");
assertThat(generated.get("path.data")).isNotNull();
assertThat(generated.get("path.logs")).isNotNull();
assertThat(generated.get("path.home")).isNotNull();
// http is disabled for security reasons
assertThat(generated.get("http.enabled")).isEqualTo("false");
assertThat(generated.get("index.number_of_replicas")).isEqualTo("0");
assertThat(generated.get("discovery.zen.ping.unicast.hosts")).isNull();
}
Aggregations