use of org.sonar.process.Props in project sonarqube by SonarSource.
the class ComputeEngineContainerImplTest method real_start.
@Test
public void real_start() throws IOException {
Properties properties = ProcessProperties.defaults();
File homeDir = tempFolder.newFolder();
File dataDir = new File(homeDir, "data");
File tmpDir = new File(homeDir, "tmp");
properties.setProperty(PATH_HOME, homeDir.getAbsolutePath());
properties.setProperty(PATH_DATA, dataDir.getAbsolutePath());
properties.setProperty(PATH_TEMP, tmpDir.getAbsolutePath());
properties.setProperty(PROPERTY_PROCESS_INDEX, valueOf(ProcessId.COMPUTE_ENGINE.getIpcIndex()));
properties.setProperty(PROPERTY_SHARED_PATH, tmpDir.getAbsolutePath());
properties.setProperty(DatabaseProperties.PROP_URL, ((BasicDataSource) dbTester.database().getDataSource()).getUrl());
properties.setProperty(DatabaseProperties.PROP_USER, "sonar");
properties.setProperty(DatabaseProperties.PROP_PASSWORD, "sonar");
// required persisted properties
insertProperty(CoreProperties.SERVER_ID, "a_startup_id");
insertProperty(CoreProperties.SERVER_STARTTIME, DateUtils.formatDateTime(new Date()));
underTest.start(new Props(properties));
MutablePicoContainer picoContainer = underTest.getComponentContainer().getPicoContainer();
assertThat(picoContainer.getComponentAdapters()).hasSize(CONTAINER_ITSELF + // level 4
75 + // content of CeConfigurationModule
4 + // content of CeQueueModule
5 + // content of CeHttpModule
3 + // content of CeTaskCommonsModule
3 + // content of ProjectAnalysisTaskModule
4 + // content of CeTaskProcessorModule
4);
assertThat(picoContainer.getParent().getComponentAdapters()).hasSize(CONTAINER_ITSELF + // level 3
5);
assertThat(picoContainer.getParent().getParent().getComponentAdapters()).hasSize(CONTAINER_ITSELF + // MigrationConfigurationModule
10 + // level 2
17);
assertThat(picoContainer.getParent().getParent().getParent().getComponentAdapters()).hasSize(COMPONENTS_IN_LEVEL_1_AT_CONSTRUCTION + // level 1
23 + // content of DaoModule
47 + // content of EsSearchModule
3 + // content of CorePropertyDefinitions
57 + // content of CePropertyDefinitions
1);
assertThat(picoContainer.getParent().getParent().getParent().getParent()).isNull();
underTest.stop();
assertThat(picoContainer.getLifecycleState().isStarted()).isFalse();
assertThat(picoContainer.getLifecycleState().isStopped()).isFalse();
assertThat(picoContainer.getLifecycleState().isDisposed()).isTrue();
}
use of org.sonar.process.Props in project sonarqube by SonarSource.
the class EsSettingsTest method cluster_is_enabled.
@Test
public void cluster_is_enabled() throws Exception {
Props props = minProps();
props.set(ProcessProperties.CLUSTER_ENABLED, "true");
props.set(ProcessProperties.CLUSTER_SEARCH_HOSTS, "1.2.3.4:9000,1.2.3.5:8080");
Settings settings = new EsSettings(props).build();
assertThat(settings.get("index.number_of_replicas")).isEqualTo("1");
assertThat(settings.get("discovery.zen.ping.unicast.hosts")).isEqualTo("1.2.3.4:9000,1.2.3.5:8080");
}
use of org.sonar.process.Props in project sonarqube by SonarSource.
the class EsSettingsTest method enable_http_connector.
@Test
public void enable_http_connector() throws Exception {
Props props = minProps();
props.set(ProcessProperties.SEARCH_HTTP_PORT, "9010");
Settings settings = new EsSettings(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");
}
use of org.sonar.process.Props in project sonarqube by SonarSource.
the class EsSettingsTest method minProps.
private Props minProps() throws IOException {
File homeDir = temp.newFolder();
Props props = new Props(new Properties());
ProcessProperties.completeDefaults(props);
props.set(ProcessProperties.PATH_HOME, homeDir.getAbsolutePath());
return props;
}
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));
}
Aggregations