use of org.sonar.process.Props in project sonarqube by SonarSource.
the class EsJvmOptionsTest method boostrap_checks_can_be_set_false_if_h2.
@Test
public void boostrap_checks_can_be_set_false_if_h2() throws IOException {
properties.put("sonar.jdbc.url", "jdbc:h2:tcp://ffoo:bar/sonar");
properties.put("sonar.es.bootstrap.checks.disable", "false");
File tmpDir = temporaryFolder.newFolder();
EsJvmOptions underTest = new EsJvmOptions(new Props(properties), tmpDir);
assertThat(underTest.getAll()).isNotEmpty().contains("-Des.enforce.bootstrap.checks=true");
}
use of org.sonar.process.Props in project sonarqube by SonarSource.
the class EsJvmOptionsTest method writeToJvmOptionFile_throws_ISE_in_case_of_IOException.
@Test
public void writeToJvmOptionFile_throws_ISE_in_case_of_IOException() throws IOException {
File notAFile = temporaryFolder.newFolder();
EsJvmOptions underTest = new EsJvmOptions(new Props(properties), temporaryFolder.newFolder());
assertThatThrownBy(() -> underTest.writeToJvmOptionFile(notAFile)).isInstanceOf(IllegalStateException.class).hasMessage("Cannot write Elasticsearch jvm options file").hasRootCauseInstanceOf(IOException.class);
}
use of org.sonar.process.Props in project sonarqube by SonarSource.
the class JvmOptionsTest method addFromMandatoryProperty_checks_against_mandatory_options_is_case_sensitive.
@Test
public void addFromMandatoryProperty_checks_against_mandatory_options_is_case_sensitive() {
String[] optionOverrides = { randomPrefix, randomPrefix + randomValue.substring(1), randomPrefix + randomValue.substring(1), randomPrefix + randomValue.substring(2), randomPrefix + randomValue.substring(3), randomPrefix + randomValue.substring(3) + randomAlphanumeric(1), randomPrefix + randomValue.substring(3) + randomAlphanumeric(2), randomPrefix + randomValue.substring(3) + randomAlphanumeric(3), randomPrefix + randomValue + randomAlphanumeric(1) };
JvmOptions underTest = new JvmOptions(ImmutableMap.of(randomPrefix, randomValue));
for (String optionOverride : optionOverrides) {
properties.setProperty(randomPropertyName, optionOverride.toUpperCase(Locale.ENGLISH));
underTest.addFromMandatoryProperty(new Props(properties), randomPropertyName);
}
}
use of org.sonar.process.Props in project sonarqube by SonarSource.
the class JvmOptionsTest method addFromMandatoryProperty_supports_spaces_inside_options.
@Test
public void addFromMandatoryProperty_supports_spaces_inside_options() {
properties.put(randomPropertyName, "-foo bar -duck");
underTest.addFromMandatoryProperty(new Props(properties), randomPropertyName);
assertThat(underTest.getAll()).containsOnly("-foo bar", "-duck");
}
use of org.sonar.process.Props in project sonarqube by SonarSource.
the class AppSettingsImplTest method reload_updates_properties.
@Test
public void reload_updates_properties() {
Props initialProps = new Props(new Properties());
initialProps.set("foo", "bar");
Props newProps = new Props(new Properties());
newProps.set("foo", "baz");
newProps.set("newProp", "newVal");
AppSettingsImpl underTest = new AppSettingsImpl(initialProps);
underTest.reload(newProps);
assertThat(underTest.getValue("foo").get()).isEqualTo("baz");
assertThat(underTest.getValue("newProp").get()).isEqualTo("newVal");
assertThat(underTest.getProps().rawProperties()).hasSize(2);
}
Aggregations