use of org.sonar.process.Props in project sonarqube by SonarSource.
the class JdbcSettingsTest method checkAndComplete_sets_driver_path_for_postgresql.
@Test
public void checkAndComplete_sets_driver_path_for_postgresql() throws Exception {
File driverFile = new File(homeDir, "lib/jdbc/postgresql/pg.jar");
FileUtils.touch(driverFile);
Props props = newProps(JDBC_URL.getKey(), "jdbc:postgresql://localhost/sonar");
underTest.accept(props);
assertThat(props.nonNullValueAsFile(JDBC_DRIVER_PATH.getKey())).isEqualTo(driverFile);
}
use of org.sonar.process.Props in project sonarqube by SonarSource.
the class JdbcSettingsTest method fail_with_MessageException_when_url_does_not_have_jdbc_prefix.
@Test
public void fail_with_MessageException_when_url_does_not_have_jdbc_prefix() {
Props props = newProps(JDBC_URL.getKey(), "oracle:thin:@localhost/XE");
assertThatThrownBy(() -> underTest.resolveProviderAndEnforceNonnullJdbcUrl(props)).isInstanceOf(MessageException.class).hasMessage("Bad format of JDBC URL: oracle:thin:@localhost/XE");
}
use of org.sonar.process.Props in project sonarqube by SonarSource.
the class JdbcSettingsTest method newProps.
private Props newProps(String... params) {
Properties properties = new Properties();
for (int i = 0; i < params.length; i++) {
properties.setProperty(params[i], params[i + 1]);
i++;
}
properties.setProperty(PATH_HOME.getKey(), homeDir.getAbsolutePath());
return new Props(properties);
}
use of org.sonar.process.Props in project sonarqube by SonarSource.
the class EsInstallationTest method getHomeDirectory_is_elasticsearch_subdirectory_of_sq_home_directory.
@Test
public void getHomeDirectory_is_elasticsearch_subdirectory_of_sq_home_directory() throws IOException {
File sqHomeDir = temp.newFolder();
Props props = new Props(new Properties());
props.set(PATH_DATA.getKey(), temp.newFolder().getAbsolutePath());
props.set(PATH_HOME.getKey(), sqHomeDir.getAbsolutePath());
props.set(PATH_TEMP.getKey(), temp.newFolder().getAbsolutePath());
props.set(PATH_LOGS.getKey(), temp.newFolder().getAbsolutePath());
EsInstallation underTest = new EsInstallation(props);
assertThat(underTest.getHomeDirectory()).isEqualTo(new File(sqHomeDir, "elasticsearch"));
}
use of org.sonar.process.Props in project sonarqube by SonarSource.
the class EsInstallationTest method constructor_fails_with_IAE_if_data_dir_property_is_not_defined.
@Test
public void constructor_fails_with_IAE_if_data_dir_property_is_not_defined() throws IOException {
Props props = new Props(new Properties());
props.set(PATH_HOME.getKey(), temp.newFolder().getAbsolutePath());
assertThatThrownBy(() -> new EsInstallation(props)).isInstanceOf(IllegalArgumentException.class).hasMessage("Missing property: sonar.path.data");
}
Aggregations