use of org.sonar.scanner.repository.ProjectRepositories in project sonarqube by SonarSource.
the class ProjectSettingsTest method should_load_project_props.
@Test
public void should_load_project_props() {
project.setProperty("project.prop", "project");
projectRef = new ProjectRepositories(emptySettings, emptyFileData, null);
ProjectSettings batchSettings = new ProjectSettings(new ProjectReactor(project), bootstrapProps, projectRef, mode);
assertThat(batchSettings.getString("project.prop")).isEqualTo("project");
}
use of org.sonar.scanner.repository.ProjectRepositories in project sonarqube by SonarSource.
the class ProjectSettingsTest method should_fail_when_accessing_secured_properties_in_issues_mode.
@Test
public void should_fail_when_accessing_secured_properties_in_issues_mode() {
Table<String, String, String> settings = HashBasedTable.create();
settings.put("struts", "sonar.foo.secured", "bar");
settings.put("struts", "sonar.foo.license.secured", "bar2");
when(mode.isIssues()).thenReturn(true);
projectRef = new ProjectRepositories(settings, emptyFileData, null);
ProjectSettings batchSettings = new ProjectSettings(new ProjectReactor(project), bootstrapProps, projectRef, mode);
assertThat(batchSettings.getString("sonar.foo.license.secured")).isEqualTo("bar2");
thrown.expect(MessageException.class);
thrown.expectMessage("Access to the secured property 'sonar.foo.secured' is not possible in issues mode. The SonarQube plugin which requires this property must be deactivated in issues mode.");
batchSettings.getString("sonar.foo.secured");
}
use of org.sonar.scanner.repository.ProjectRepositories in project sonarqube by SonarSource.
the class ModuleSettingsTest method should_fail_when_accessing_secured_properties_in_issues.
@Test
public void should_fail_when_accessing_secured_properties_in_issues() {
GlobalSettings globalSettings = newGlobalSettings(ImmutableMap.of("sonar.foo.secured", "bar"));
ProjectRepositories projSettingsRepo = createSettings("struts-core", ImmutableMap.of("sonar.foo.license.secured", "bar2"));
when(mode.isIssues()).thenReturn(true);
ProjectDefinition module = ProjectDefinition.create().setKey("struts-core");
ModuleSettings moduleSettings = new ModuleSettings(globalSettings, module, projSettingsRepo, mode, mock(AnalysisContextReportPublisher.class));
assertThat(moduleSettings.getString("sonar.foo.license.secured")).isEqualTo("bar2");
thrown.expect(MessageException.class);
thrown.expectMessage("Access to the secured property 'sonar.foo.secured' is not possible in issues mode. The SonarQube plugin which requires this property must be deactivated in issues mode.");
moduleSettings.getString("sonar.foo.secured");
}
use of org.sonar.scanner.repository.ProjectRepositories in project sonarqube by SonarSource.
the class ModuleSettingsTest method test_loading_of_module_settings.
@Test
public void test_loading_of_module_settings() {
GlobalSettings globalSettings = newGlobalSettings(ImmutableMap.of("overridding", "batch", "on-batch", "true"));
ProjectRepositories projRepos = createSettings("struts-core", ImmutableMap.of("on-module", "true", "overridding", "module"));
ProjectDefinition module = ProjectDefinition.create().setKey("struts-core");
ModuleSettings moduleSettings = new ModuleSettings(globalSettings, module, projRepos, mode, mock(AnalysisContextReportPublisher.class));
assertThat(moduleSettings.getString("overridding")).isEqualTo("module");
assertThat(moduleSettings.getString("on-batch")).isEqualTo("true");
assertThat(moduleSettings.getString("on-module")).isEqualTo("true");
}
use of org.sonar.scanner.repository.ProjectRepositories in project sonarqube by SonarSource.
the class ModuleSettingsTest method should_not_fail_when_accessing_secured_properties.
@Test
public void should_not_fail_when_accessing_secured_properties() {
GlobalSettings globalSettings = newGlobalSettings(ImmutableMap.of("sonar.foo.secured", "bar"));
ProjectRepositories projSettingsRepo = createSettings("struts-core", ImmutableMap.of("sonar.foo.license.secured", "bar2"));
ProjectDefinition module = ProjectDefinition.create().setKey("struts-core");
ModuleSettings moduleSettings = new ModuleSettings(globalSettings, module, projSettingsRepo, mode, mock(AnalysisContextReportPublisher.class));
assertThat(moduleSettings.getString("sonar.foo.license.secured")).isEqualTo("bar2");
assertThat(moduleSettings.getString("sonar.foo.secured")).isEqualTo("bar");
}
Aggregations