use of org.sonar.scanner.bootstrap.GlobalSettings in project sonarqube by SonarSource.
the class ModuleSettingsTest method test_loading_of_parent_module_settings_for_new_module.
// SONAR-6386
@Test
public void test_loading_of_parent_module_settings_for_new_module() {
GlobalSettings globalSettings = newGlobalSettings(ImmutableMap.of("overridding", "batch", "on-batch", "true"));
ProjectRepositories projRepos = createSettings("struts", ImmutableMap.of("on-module", "true", "overridding", "module"));
ProjectDefinition module = ProjectDefinition.create().setKey("struts-core");
ProjectDefinition.create().setKey("struts").addSubProject(module);
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.bootstrap.GlobalSettings in project sonarqube by SonarSource.
the class AnalysisContextReportPublisherTest method prepare.
@Before
public void prepare() throws Exception {
logTester.setLevel(LoggerLevel.INFO);
system2 = mock(System2.class);
when(system2.properties()).thenReturn(new Properties());
projectRepos = mock(ProjectRepositories.class);
globalSettings = mock(GlobalSettings.class);
publisher = new AnalysisContextReportPublisher(analysisMode, pluginRepo, system2, projectRepos, globalSettings);
}
use of org.sonar.scanner.bootstrap.GlobalSettings in project sonarqube by SonarSource.
the class ProjectSettingsTest method prepare.
@Before
public void prepare() {
emptyFileData = ImmutableTable.of();
emptySettings = ImmutableTable.of();
project = ProjectDefinition.create().setKey("struts");
globalMode = mock(GlobalMode.class);
mode = mock(DefaultAnalysisMode.class);
bootstrapProps = new GlobalSettings(new GlobalProperties(Collections.<String, String>emptyMap()), new PropertyDefinitions(), mock(SettingsLoader.class), globalMode);
}
use of org.sonar.scanner.bootstrap.GlobalSettings 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.bootstrap.GlobalSettings 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");
}
Aggregations