use of org.sonar.api.batch.bootstrap.ProjectDefinition 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.api.batch.bootstrap.ProjectDefinition in project sonarqube by SonarSource.
the class ModuleSettingsTest method testOrderedProjects.
@Test
public void testOrderedProjects() {
ProjectDefinition grandParent = ProjectDefinition.create();
ProjectDefinition parent = ProjectDefinition.create();
ProjectDefinition child = ProjectDefinition.create();
grandParent.addSubProject(parent);
parent.addSubProject(child);
List<ProjectDefinition> hierarchy = ModuleSettings.getTopDownParentProjects(child);
assertThat(hierarchy.get(0)).isEqualTo(grandParent);
assertThat(hierarchy.get(1)).isEqualTo(parent);
assertThat(hierarchy.get(2)).isEqualTo(child);
}
use of org.sonar.api.batch.bootstrap.ProjectDefinition 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.api.batch.bootstrap.ProjectDefinition 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");
}
use of org.sonar.api.batch.bootstrap.ProjectDefinition in project sonarqube by SonarSource.
the class ProjectLockTest method setUpTest.
private ProjectLock setUpTest(File file) {
ProjectReactor projectReactor = mock(ProjectReactor.class);
ProjectDefinition projectDefinition = mock(ProjectDefinition.class);
when(projectReactor.getRoot()).thenReturn(projectDefinition);
when(projectDefinition.getWorkDir()).thenReturn(file);
return new ProjectLock(projectReactor);
}
Aggregations